PGPLOT::Device::PGWin - convenience class for PDL::Graphics::PGPLOT::Window
version 0.12
$pgwin = PGPLOT::Device::PGWin->new( { device => $user_device_spec, winopts => \%opts } ); $pgwin->override( $override ); $win = $pgwin->next; $win->env( ... ); $pgwin->finish;
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.
$pgwin = PGPLOT::Device::PGWin->new( \%opts );
Create a new object. The possible options are:
The device specification. This is passed directly to "new" in PGPLOT::Device, so see its documentation.
A hashref containing options to pass to "new" in PGPLOT::Device.
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
# retrieve a copy of the current set of dinwo options. $winopts = $pgwin->winopts;
$dev = $pgwin->device
This method returns the underlying PGPLOT::Device object.
$win = $pgwin->next( ?\%winopts, ?$spec );
Return the window handle to use for constructing the next plot. If the device is not changing, simply returns the existing window handle.
%winopts
If %winopts is provided, it will be used to replace the previous set of window options. To merely amend that, set
%winopts = ( %{ $pgwin->winopts }, %newoptions );
If the device is not changing, some poking at PDL::Graphics::PGPLOT::Window innards must be performed so that the current window will pay attention to the new options. Only the following options are handled:
Justify NXPanel NYPanel
$spec
If the optional argument $spec is provided, it is equivalent to
$pgwin->override( $spec ); $pgwin->next;
$pgwin->override( ... );
This calls the override method of the associated PGPLOT::Device object.
$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.
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;
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 is available at
https://gitlab.com/djerius/pgplot-device
and may be cloned from
https://gitlab.com/djerius/pgplot-device.git
Please see those modules/websites for more information related to this module.
PGPLOT::Device
PGPLOT
PDL
PDL::Graphics::PGPLOT::Window
Diab Jerius <djerius@cpan.org>
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
To install PGPLOT::Device, copy and paste the appropriate command in to your terminal.
cpanm
cpanm PGPLOT::Device
CPAN shell
perl -MCPAN -e shell install PGPLOT::Device
For more information on module installation, please visit the detailed CPAN module installation guide.