with data like this:
2011/02/01-03:31 0.59
2011/02/01-09:48 9.93
2011/02/01-16:11 -0.34
2011/02/01-22:24 8.88
2011/02/02-04:18 0.44
2011/02/02-10:32 9.96
2011/02/02-16:53 -0.36
set xdata time
set timefmt x "%Y/%m/%d-%H:%M"
set samples 1000
plot 'data.txt' u 1:2 sm cspl
Find a way to change the curve color at any value > or < 1 (for
example).
OSX 10.6.6
GNUplot Version 4.4 patchlevel 2
maybe the hard way:
ycr=0.1
plot "data.txt u 1:($2>ycr?$2:1/0) lt 1 ,"" u 1:($2<=ycr?$2:1/0) lt 2 t ""
Can you use multiplot and position 2 plots so that 1 plot is above the
other:
For example:
Plot A: YRange [0:1]
PLot B: Yrange [1:10]
set origin 0,0
plot data with linecolor 1
set origin 0,1
plot data with linecolor 2
presumably data on plat A where y>1 would be clipped and data on plot
B where y<1 would be clipped.
You also want to turn off the xaxis and tic marks for plot B and make
sure the xrange for both plot is the same etc, etc.
Well, the bit of progress I've made is the following, using code I
found (here, http://skuld.bmsc.washington.edu/~merritt/gnuplot/demo_svg/stringvar.html):
In multiplot: ("2" is just a test number for the condition), this
works nicely:
plot 'data.txt' u 1:2:($2>2) w filledcurves above lc rgb "blue"
plot 'data.txt' u 1:2:($2<2) w filledcurves below lc rgb "red"
but I've been unable to work out how to modify this to use the "sm
cspl" to draw lines rather than filled curves, which I do not want.
Would something like this do the trick?
color(y) = y >= 0 ? (255*65535) : (255*255)
plot "data.in" using 1:2:(color($2)) with lines linecolor rgb variable
Tweak the definition of the "color()" function to give the desired colors.
The one above gives me yellow for y >= 0, green for y < 0.
(someone on this group showed me that a few years ago & it's been handy)
--
Al Dunstan, Software Engineer
OptiMetrics, Inc.
3115 Professional Drive
Ann Arbor, MI 48104-5131
"There are two ways of constructing a software design. One way is to make
it so simple that there are obviously no deficiencies. And the other way
is to make it so complicated that there are no obvious deficiencies."
- C. A. R. Hoare
I'm unable to reproduce Al's results. It looks like a good solution.
Can anyone confirm for me that it works?
If so, perhaps dump for me the terminal settings and options you are
using?
gnuplot> show terminal
terminal type is wxt 0
In ~/.gnuplot-wxt I've got:
raise=1
persist=0
ctrl=0
rendering=2
hinting=100
I've done output to JPG and PostScript files this way too (although it was a
few years ago). I'm using Gnuplot 4.2 patchlevel 3 on Fedora 10.
--
Al
OSX + Aqua doesn't offer wxt, so I guess I'll try out some others.
Many thanks!
Ooops, typo, OSX + gnuplot doesn't offer the wxt terminal. Apologies.
It works with 'set terminal x11', too, if that's of any use to you.
--
Al Dunstan, Software Engineer
OptiMetrics, Inc.
3115 Professional Drive
Ann Arbor, MI 48104-5131
"There are two ways of constructing a software design. One way is to make