Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.graphics.apps.gnuplot > #2074
| Newsgroups | comp.graphics.apps.gnuplot |
|---|---|
| Followup-To | comp.graphics.apps.gnuplot |
| From | "A. W. Dunstan" <no@spam.thanks> |
| Subject | Re: change line color when plot crosses Y value |
| Date | 2011-02-03 12:02 -0500 |
| References | <15c8f4bc-fd7b-4486-972d-9321f6c96c62@m27g2000prj.googlegroups.com> <j7WdnSJ9k6lXg9XQnZ2dnUVZ_tOdnZ2d@speakeasy.net> <f11293a5-d9c7-4bb6-b5be-cba14c0ee40f@m27g2000prj.googlegroups.com> |
| Organization | OptiMetrics, Inc. |
| Message-ID | <08CdncNFKaovQtfQnZ2dnUVZ_tCdnZ2d@speakeasy.net> (permalink) |
Followups directed to: comp.graphics.apps.gnuplot
ginginsman wrote: > On Feb 1, 3:55 pm, "A. W. Dunstan" <n...@spam.thanks> wrote: >> ginginsman wrote: >> > I know I have seen this somewhere but cannot find it: I'd like to find >> > a way to change the color of a plot line when it crosses a specified >> > value of Y; blue above, red below, for example. >> >> > 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 >> >> 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 > > 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
Back to comp.graphics.apps.gnuplot | Previous | Next — Next in thread | Find similar | Unroll thread
Re: change line color when plot crosses Y value "A. W. Dunstan" <no@spam.thanks> - 2011-02-03 12:02 -0500
Re: change line color when plot crosses Y value ginginsman <dbh@suiattle.org> - 2011-02-03 11:57 -0800
Re: change line color when plot crosses Y value "A. W. Dunstan" <no@spam.thanks> - 2011-02-04 10:00 -0500
Re: change line color when plot crosses Y value ginginsman <dbh@suiattle.org> - 2011-02-03 12:14 -0800
csiph-web