Generate real-time graphs with Gnuplot software. Quick and easy plotting on the fly.
To plot a chart using Chart::Gnuplot, you will need to create a chart object and at least one dataset object. The chart object is where you will define information such as the output file, chart title, axes labels, and more. The dataset object contains information about the data to be plotted, including the source of the data points, dataset label, color to be used, and more. Once these objects have been created, you can plot your chart using the plot2d, plot3d, or multiplot method of the chart object.
To get a better understanding of how Chart::Gnuplot works and what it is capable of, it is incredibly helpful to look at some examples. Fortunately, Chart::Gnuplot comes with a plethora of examples to help you get started.
Here is an example's SYNOPSIS that shows how to create a chart object and specify its properties:
use Chart::Gnuplot;
# Data
my @x = (-10 .. 10);
my @y = (0 .. 20);
# Create chart object and specify chart properties
my $chart = Chart::Gnuplot->new(
output => 'fig/simple.png'
title => 'Simple testing',
xlabel => 'My x-axis label',
ylabel => 'My y-axis label',
...
);
# Create dataset object and specify dataset properties
my $dataSet = Chart::Gnuplot::DataSet->new(
xdata => @x,
ydata => @y,
title => 'Plotting a line from Perl arrays',
style => 'linespoints',
...
);
# Plot data set on chart
$chart->plot2d($dataSet);
Additionally, you can plot multiple data sets on a single chart by passing them as arguments to the plot2d method:
# Plot many data sets on a single chart
$chart->plot2d($dataSet1, $dataSet2, ...);
Overall, Chart::Gnuplot is an incredibly powerful and versatile tool for generating graphs and charts in Perl. With the ability to customize and specify nearly every aspect of your chart, the possibilities are nearly endless.
Version 0.11: N/A