in reply to Two questions for GD::Graph
Yes, both rotating the values and adding a grid is possible with just a few set commands. The following code, modified from Plot a spiral with gnuplot, does both.
use strict; use warnings; use 5.010; use IO::Handle; use File::Temp "tempfile"; my($T,$N) = tempfile("plot-XXXXXXXX", "UNLINK", 1); for my $t (100..500) { say $T $t*sin($t*0.1), " ", $t*cos($t*0.1); } open my $P, "|-", "gnuplot" or die; printflush $P qq[ unset key set xtics rotate by -45 #set grid # vertical and horizontal grid lines set grid xtics # vertical grid lines only plot "$N" with lines lw 3 ]; <STDIN>; close $P; __END__
Update: rotating the text is tricky in that some of the terminals (output drivers of gnuplot) does not support it, or only supports rotating by multiples of right angles. This may also depend on the version of gnuplot you have. Rotating the text by any angle does work in at least the postscript driver though.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Two questions for GD::Graph
by tilly (Archbishop) on Jan 13, 2011 at 17:18 UTC |