The Perl Toolchain Summit needs more sponsors. If your company depends on Perl, please support this very important event.

NAME

Lab::Moose::DataFile::Gnuplot::2D - 2D data file with live plotting support.

SYNOPSIS

 use Lab::Moose;

 my $folder = datafolder();
 
 my $file = datafile(
     type => 'Gnuplot::2D',
     folder => $folder,
     filename => 'gnuplot-file.dat',
     columns => [qw/time voltage temp/]
     );

  $file->add_plot(
     x => 'time',
     y => 'voltage',
     curve_options => {with => 'points'},
     hard_copy => 'gnuplot-file-T-V.png',
  );
   
  $file->add_plot(
      x => 'time',
      y => 'temp',
      hard_copy => 'gnuplot-file-T-Temp.png',
  );

 $file->log(time => 1, voltage => 2, temp => 3);

DESCRIPTION

This submodule of Lab::Moose::DataFile::Gnuplot provides live plotting of 2D data with gnuplot. It requires PDL::Graphics::Gnuplot installed.

METHODS

This module inherits all methods of Lab::Moose::DataFile::Gnuplot.

add_plot

 $file->add_plot(
     x => 'x-column',
     y => 'y-column',
     plot_options => {grid => 1, xlabel => 'voltage', ylabel => 'current'},
     curve_options => {with => 'points'},
     hard_copy => 'myplot.png',
     hard_copy_terminal => 'svg',
 );

Add a new live plot to the datafile. Options:

  • x (mandatory)

    Name of the column which is used for the x-axis.

  • y (mandatory)

    Name of the column which is used for the y-axis.

  • terminal

    gnuplot terminal. Default is qt.

  • terminal_options

    HashRef of terminal options. For the qt and x11 terminals, this defaults to {persist => 1, raise => 0}.

  • plot_options

    HashRef of plotting options (See PDL::Graphics::Gnuplot for the complete list).

  • curve_options

    HashRef of curve options (See PDL::Graphics::Gnuplot for the complete list).

  • handle

    Set this to a string, if you need to refresh the plot manually with the refresh_plots option. Multiple plots can share the same handle string.

  • hard_copy

    Create a copy of the plot in the data folder.

  • hard_copy_terminal

    Terminal for hard_copy option. Use png terminal by default. The 'output' terminal option must be supported.

refresh_plots

 $file->refresh_plots(handle => $handle);
 $file->refresh_plots();

Call refresh_plot for each plot with hanle $handle.

If the handle argument is not given, refresh all plots.