Lab::Moose::DataFile::Gnuplot - Text based data file ('Gnuplot style')
version 3.620
use Lab::Moose; my $folder = datafolder(); # datafile with two simple 2D plots: my $file = datafile( type => 'Gnuplot', 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); # datafile with pm3d plot my $datafile = datafile( type => 'Gnuplot', folder => datafolder(), filename => 'data.dat', columns => [qw/x y z/], ); $datafile->add_plot( type => 'pm3d', x => 'x', y => 'y', z => 'z', hard_copy => 'data.png', ); for my $x (0..100) { for my $y (0..100) { $datafile->log(x => $x, y => $y, z => rand()); } $datafile->new_block(); }
Supports the following attributtes in addition to the Lab::Moose::DataFile requirements:
columns
(mandatory) arrayref of column names
precision
The numbers are formatted with a %.${precision}g format specifier. Default is 10.
%.${precision}g
$file->log(column1 => $value1, column2 => $value2, ...);
Log one line of data.
$file->log_block( prefix => {column1 => $value1, ...}, block => $block, add_newline => 1 );
Log a 1D or 2D PDL or array ref. The first dimension runs over the datafile rows. You can add prefix columns, which will be the same for each line in the block. E.g. when using a spectrum analyzer inside a voltage sweep, one would log the returned PDL prefixed with the sweep voltage.
$file->new_block()
print "\n" to the datafile.
$file->log_comment(comment => $string);
log a comment string, which will be prefixed with '#'. If $string contains newline characters, several lines of comments will be written.
$string
$file->add_plot( type => 'pm3d', x => 'x-column', y => 'y-column', z => 'z-column', plot_options => {grid => 1}, hard_copy => 'myplot.png', hard_copy_terminal => 'svg', );
Add a new live plot to the datafile. Options:
type
Supported types: points (default), pm3d.
points (default), pm3d
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.
z (mandatory for 3d plot)
Name of the column which is used tor the cb-axis in a pm3d plot.
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}.
{persist => 1, raise => 0}
plot_options
HashRef of plotting options (See PDL::Graphics::Gnuplot for the complete list). Those are appended to the default plot options.
curve_options
HashRef of curve options (See PDL::Graphics::Gnuplot for the complete list).
refresh
Set this to a string, if you need to refresh the plot manually with the refresh_plots option. Multiple plots can share the same refresh handle string.
refresh_plots
Predefined refresh types:
'point'
Default for 2D plots. Replot for each new row.
'block'
Default for 3D plots. Replot when finishing a block.
hard_copy
Create a copy of the plot in the data folder. Default: do not create hard copy.
hard_copy_terminal
Terminal for hard_copy option. Use png terminal by default. The 'output' terminal option must be supported.
$file->refresh_plots(refresh => $refresh_type); # or $file->refresh_plots();
Call refresh_plot for each plot with hanle $handle.
refresh_plot
$handle
If the handle argument is not given, refresh all plots.
handle
This software is copyright (c) 2018 by the Lab::Measurement team; in detail:
Copyright 2016 Simon Reinhardt 2017 Andreas K. Huettel, Simon Reinhardt 2018 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.
To install Lab::Measurement, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Lab::Measurement
CPAN shell
perl -MCPAN -e shell install Lab::Measurement
For more information on module installation, please visit the detailed CPAN module installation guide.