Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl: the Markov chain saw

Re: Create a plot / chart with dates as x-values?

by Anonymous Monk
on Jan 02, 2013 at 18:34 UTC ( #1011329=note: print w/replies, xml ) Need Help??

in reply to Create a plot / chart with dates as x-values?

Ok, thanks, all. Chart::Gnuplot did exactly what I wanted:

#!/usr/bin/env perl use Modern::Perl; use DateTime; use Chart::Gnuplot; my @x_vals = qw/ 2012-11-07 2012-11-08 2012-11-15 2012-11-19 2012-11-30 /; my @y_vals = ( 11, 12, 13, 14, 15, ); my $chart = Chart::Gnuplot->new( output => 'plot.png', title => 'plot title', xlabel => 'x label', ylabel => 'y label', timeaxis => 'x', xtics => { labelfmt => '%Y-%m-%d', rotate => -90, }, ); my $dataset = Chart::Gnuplot::DataSet->new( xdata => \@x_vals, ydata => \@y_vals, title => 'data title', style => 'linespoints', timefmt => '%Y-%m-%d', ); $chart->plot2d($dataset);

As noted in its docs, useful examples at

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://1011329]
[sierpinski]: I've never seen $#$var before.
[LanX]: $list cops be an array ref
[LanX]: could
[LanX]: $#array gives the length
[LanX]: no sorry ...
[sierpinski]: so that would just be deferencing it...
[LanX]: the last index!
[LanX]: yes
[sierpinski]: yeah I guess $list is a reference.. yeah
[sierpinski]: why is it the last index and not the first? because the length of the array becomes the index?

How do I use this? | Other CB clients
Other Users?
Others chanting in the Monastery: (13)
As of 2017-12-13 16:00 GMT
Find Nodes?
    Voting Booth?
    What programming language do you hate the most?

    Results (369 votes). Check out past polls.