NAME

PGPLOT::Device::PGWin - convenience class for PDL::Graphics::PGPLOT::Window

VERSION

version 0.09

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;

BUGS

Please report any bugs or feature requests on the bugtracker website https://rt.cpan.org/Public/Dist/Display.html?Name=PGPLOT-Device or by email to bug-PGPLOT-Device@rt.cpan.org.

When submitting a bug or request, please include a test-file or a patch to an existing test-file that illustrates the bug or desired feature.

SOURCE

The development version is on github at https://github.com/djerius/pgplot-device and may be cloned from git://github.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