I'm using the Perl module Chart::Gnuplot to produce some ASCII plots with
my $chart = Chart::Gnuplot->new(
xrange => [0, 10],
yrange => [0, 10],
my $dataset = Chart::Gnuplot::DataSet->new(
style => "dots",
xdata => \@xvals,
ydata => \@yvals
$chart->plot2d($dataset); # This works
my $textplot = $chart->plot2d($dataset); # This does not work, nor did I expect it to
print($textplot); # Prints a hash ref like "Chart::Gnuplot=HASH(0x6000cbb80)"
Create a temporary file (say using File::Temp) and pass its path to the constructor's
output option. You can collect the output from that temporary file.