NAME
PGPLOT::Device::PGWin - convenience class for PDL::Graphics::PGPLOT::Window
VERSION
version 0.10
SYNOPSIS
$pgwin = PGPLOT::Device::PGWin->new( { device => $user_device_spec,
WinOpts => \%opts } );
$pgwin->override( $override );
$win = $pgwin->next;
$win->env( ... );
$pgwin->finish;
DESCRIPTION
PGPLOT::Device::PGWin is a convenience class which combines PGPLOT::Device and PDL::Graphics::PGPLOT::Window. It provides the logic to handle interactive devices (as illustrated in the Examples section of the PGPLOT::Device documentation).
Note that the "close" in PDL::Graphics::PGPLOT::Window method should never be called when using this module, as that will surely mess things up.
METHODS
new
$pgwin = PGPLOT::Device::PGWin->new( \%opts );
Create a new object. The possible options are:
- Device
-
The device specification. This is passed directly to "new" in PGPLOT::Device, so see it's documentation.
- DevOpts
-
A hashref containing options to pass to "new" in PGPLOT::Device.
- WinOpts
-
A hashref containing options to pass to "new" in PDL::Graphics::PGPLOT::Windows. Do not include a
Device
option as that will break things.
device
$dev = $pgwin->device
This method returns the underlying PGPLOT::Device object.
next
$win = $pgwin->next( );
$win = $pgwin->next( $override );
This method returns the window handle to use for constructing the next plot. If the optional argument is specified, it is equivalent to the following call sequence:
$pgwin->override( $override );
$pgwin->next;
override
$pgwin->override( ... );
This is calls the override method of the associated PGPLOT::Device object.
finish
$pgwin->finish();
Close the associated device. This must be called to handle prompting for ephemeral interactive graphic devices before a program finishes execution.
This is not automatically called upon object destruction as there seems to be an ordering problem in destructors called during Perl's cleanup phase such that the underlying PDL::Graphics::PGPLOT::Window object is destroyed before this object.
EXAMPLES
my $pgwin = PGPLOT::Device::PGWin->new( { Device => $user_spec } );
eval {
for my $plot in ( qw/ plot1 plot2 / )
{
$pgwin->override( $plot );
my $win = $pgwin->next();
$win->env( ... );
...
}
};
my $error = $@;
$pgwin->finish;
die $error if $error;
SUPPORT
Bugs
Please report any bugs or feature requests to bug-pgplot-device@rt.cpan.org or through the web interface at: https://rt.cpan.org/Public/Dist/Display.html?Name=PGPLOT-Device
Source
Source is available at
https://gitlab.com/djerius/pgplot-device
and may be cloned from
https://gitlab.com/djerius/pgplot-device.git
SEE ALSO
Please see those modules/websites for more information related to this module.
AUTHOR
Diab Jerius <djerius@cpan.org>
COPYRIGHT AND LICENSE
This software is Copyright (c) 2017 by Smithsonian Astrophysical Observatory.
This is free software, licensed under:
The GNU General Public License, Version 3, June 2007