Hi, Mark, PLplot has some good date-plotting stuff, and I'm glad Cliff and Doug have steered you in the right direction. Gnuplot also has good date support, using UNIX time.
For a good example, you can look about halfway through my gnuplot tutorial video (http://www.youtube.com/watch?v=hUXDQL3rZ_0). The date plotting section starts at minute 6:30. Cheers, Craig On Apr 26, 2013, at 9:07 AM, Mark Grimes <[email protected]> wrote: > Hi all, > > I am somewhat new to PDL, but I love Perl and am looking to use > Perl/PDL for some statistical/machine learning based financial > analysis. I've seen lot's of code in Python and R for these purposes, > but not much yet for Perl/PDL. I hope to correct that! > > Anyway, one stumbling block has been graphing date/time series. There > are a bunch of good graphing options for PDL, but I have not been able > to figure out how put dates on the x-axis for any of them. So far I > have been gravitating towards PLplot, but I like Prima and am > certainly not committed to anything yet. > > I did see some documentation refering to "pltimefmt", but I really > don't know where to start with that. > > Just to be complete, here is a snippet of code. Ideally, $x would be a > list of dates: > > sub plot_returns { > my ( $values, $mkt_values ) = @_; > > my $pl = PDL::Graphics::PLplot->new( DEV => "xwin", ); > my $x = sequence( nelem($values) ); > > my $returns = $values / $values->(0) - 1; > my $mkt_returns = $mkt_values / $mkt_values->(0) - 1; > $pl->xyplot( > $x, $returns, > TITLE => 'Portfolio Return', > XBOX => 'anst', > COLOR => 'BLUE', > CHARSIZE => 0.75, > YLAB => 'Returns', > BOX => [ $x->minmax, cat( $returns, $mkt_returns )->minmax ], > ); > $pl->xyplot( $x, $mkt_returns, COLOR => 'BLACK', ); > $pl->close; > } > > Thanks, > Mark > > _______________________________________________ > Perldl mailing list > [email protected] > http://mailman.jach.hawaii.edu/mailman/listinfo/perldl > _______________________________________________ Perldl mailing list [email protected] http://mailman.jach.hawaii.edu/mailman/listinfo/perldl
