|
From: Eric S. <eri...@co...> - 2006-01-17 16:00:53
|
Hi,
I have been working with GNU plot and the autoscale function and have been
having some trouble. Using "set autoscale ymax" does not seem to yield the
result that I thought it would. Hopefully someone can shed some light on
this for me.
Here is an output of my plot directives:
set data style lines
set grid
set term pbm color
set autoscale ymax
set xrange [0:7]
set tics in
set format x ''
set title "01/04/06 through 01/11/06"
set ylabel "Load Average"
set label 1 "Wednesday 04" at 0.5,-.08 center
set label 2 "Thursday 05" at 1.5,-.08 center
set label 3 "Friday 06" at 2.5,-.08 center
set label 4 "Saturday 07" at 3.5,-.08 center
set label 5 "Sunday 08" at 4.5,-.08 center
set label 6 "Monday 09" at 5.5,-.08 center
set label 7 "Tuesday 10" at 6.5,-.08 center
set xtics ("" 1, "" 2, "" 3, "" 4, "" 5, "" 6, "" 7, "" 8, "" 9, "" 10, ""
11, "" 12, "" 13, "" 14, "" 15, "" 16, "" 17, "" 18, "" 19, "" 20, "" 21, ""
22, "" 23, "" 24, "" 25, "" 26, "" 27, "" 28, "" 29, "" 30, "" 31, "" 32, ""
33, "" 34, "" 35, "" 36, "" 37, "" 38, "" 39, "" 40, "" 41, "" 42, "" 43, ""
44, "" 45, "" 46, "" 47, "" 48, "" 49, "" 50, "" 51, "" 52, "" 53, "" 54, ""
55, "" 56, "" 57, "" 58, "" 59, "" 60)
plot '< cat /data | awk "{ if (\$2 > 004) print \$2 - 004, \$6 }"' title
"host"
The labels for the x axis (1-7) do not show up, because the resulting graph
(see http://spot.colorado.edu/~schoelle/untitled.bmp) has it's y values
starting at 2 instead of 0.
I figured with "set autoscale ymax" GNUplot would only adjust the maximum
value on the y axis and leave the minimum values starting at 0.
I thought maybe I was thinking of this backwards and tried "set autoscale
ymin" - but no change resulted in the graph.
What the heck am I doing wrong???
Thanks.
PS. Please reply to me if you can, I don't know if I can subscribe to the
list/newsgroup.
Eric Schoeller
ITS Enterprise Services
University of Colorado at Boulder
|
|
From: Hans-Bernhard B. <br...@ph...> - 2006-01-18 14:33:28
|
Eric Schoeller wrote: > I have been working with GNU plot and the autoscale function and have been > having some trouble. Using "set autoscale ymax" does not seem to yield the > result that I thought it would. That's because you misunderstood the relation between 'set yrange' and 'set autoscale'. In particular, 'set autoscale ymax' will not make any difference at all if you never 'set yrange' to some particular value before. The effect you want is most directly obtained by set yrange [0:*] The start-up default for both axes in gnuplot is 'autoscale' with a fall-back of [-10:10] for the x range in case you plot only an explicit function, without giving any x range. 'set autoscale ymax' in that situation has no effect, because the upper end of the yrange is already set to be autoscaled. > The labels for the x axis (1-7) do not show up, because the resulting graph > (see http://spot.colorado.edu/~schoelle/untitled.bmp) has it's y values > starting at 2 instead of 0. The problem with your script is that you never mentioned, anywhere, that the y axis was supposed to start at 0. |
|
From: Eric S. <eri...@co...> - 2006-01-18 15:21:59
|
Hans-Bernhard Broeker wrote: > Eric Schoeller wrote: >> I have been working with GNU plot and the autoscale function and have >> been >> having some trouble. Using "set autoscale ymax" does not seem to >> yield the >> result that I thought it would. > > That's because you misunderstood the relation between 'set yrange' and > 'set autoscale'. In particular, 'set autoscale ymax' will not make > any difference at all if you never 'set yrange' to some particular > value before. The effect you want is most directly obtained by > > set yrange [0:*] > > The start-up default for both axes in gnuplot is 'autoscale' with a > fall-back of [-10:10] for the x range in case you plot only an > explicit function, without giving any x range. 'set autoscale ymax' > in that situation has no effect, because the upper end of the yrange > is already set to be autoscaled. > >> The labels for the x axis (1-7) do not show up, because the resulting >> graph >> (see http://spot.colorado.edu/~schoelle/untitled.bmp) has it's y values >> starting at 2 instead of 0. > > The problem with your script is that you never mentioned, anywhere, > that the y axis was supposed to start at 0. Thanks, that helped me out a bunch. I absolutely misunderstood those directives. At least now I can get y=0 to show up consistently! The data I'm plotting can range from y=3 to as great as y=2000 so this is causing a lot of problems with the labels along the x axis as I have no way of scaling their position correctly in relation to whatever ymax is generated by autoscale. So sometimes the labels show up, sometimes they are too high (st rattling the y=0 line) and sometimes they are cut off along the bottom. I'm setting the labels like this: set label 1 "Wednesday 11" at 0.5,-.08 center the -.08 is obviously the problem, but if i never know what ymax is it's tough to compute what that value should be for a particular graph. Are there any other gnuplot directives that i could issue to automatically place the labels at the right y offset? Thanks for all your help. Eric |
|
From: Hans-Bernhard B. <br...@ph...> - 2006-01-18 15:52:39
|
Eric Schoeller wrote: > The data I'm plotting can range from y=3 to as great as y=2000 so this > is causing a lot of problems with the labels along the x axis That's because your way of generating those labels is rather sub-optimal. First of all, placing them via 'set xtics' would almost certainly be a better idea than doing that via 'set label'. Second, if you must use 'set label', you should use graph or screen coordinates, not data coordinates, in cases where you don't know the data scale. See 'help label' and 'help coordinate' for more details. |