++ed by:
AMBA

1 PAUSE user
1 non-PAUSE user.

Andreas K. Hüttel
and 4 contributors

NAME

Lab::Moose::Plot - Frontend to PDL::Graphics::Gnuplot

VERSION

version 3.611

SYNOPSIS

 use PDL;
 use Lab::Moose::Plot;

 # use default terminal 'qt'
 my $plot = Lab::Moose::Plot->new();

 # simple 2-D plot
 my $x = sequence(10);
 my $y = 2 * $x;

 $plot->plot(
     plot_options => {title => 'linear function'},
     curve_options => {legend => '2 * x'},
     data => [$x, $y]
 );

 # pm3d plot
 my $z = sin(rvals(300, 300) / 10);
 my $x = xvals($z);
 my $y = yvals($z);

 $plot->splot(
     plot_options => {
         title => 'a pm3d plot',
         pm3d => 1,
         view => 'map',
         surface => 0,
         palette => "model RGB defined ( 0 'red', 1 'yellow', 2 'white' )",
     },
     data => [$x, $y, $z],
 );

 
 # use a different terminal with default plot options

 my $plot = Lab::Moose::Plot(
     terminal => 'svg',
     terminal_options => {output => 'file.svg', enhanced => 0},
     plot_options => {pm3d => 1, view => 'map', surface => 0}
 );

DESCRIPTION

This is a small wrapper around PDL::Graphics::Gnuplot with the aim to make it accessible with our hash-based calling convention.

See the documentation of PDL::Graphics::Gnuplot for the allowed values of terminal-, plot- and curve-options.

METHODS

new

 my $plot = Lab::Moose::Plot->new(
     terminal => $terminal,
     terminal_options => \%terminal_options,
     plot_options => \%plot_options,
     curve_options => \%curve_options,
 );

Construct a new plotting backend. All arguments are optional. The default for terminal is 'qt'. For the 'qt' and 'x11' terminals, terminal_options defaults to {persist => 1, raise => 0 }. The default for plot_options and curve_options is the empty hash.

plot

 $plot->plot(
     plot_options => \%plot_options,
     curve_options => \%curve_options,
     data => [$x, $y, $z],
 );

Call PDL::Graphics::Gnuplot's plot function. The data array can contain either PDLs ore 1D arrad refs. The required number of elements in the array depends on the used plotting style.

splot

replot

splot and replot call PDL::Graphics::Gnuplot's splot and replot functions. Otherwise they behave like plot.

COPYRIGHT AND LICENSE

This software is copyright (c) 2017 by the Lab::Measurement team; in detail:

  Copyright 2016       Simon Reinhardt
            2017       Andreas K. Huettel, Simon Reinhardt

This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.