Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.graphics.apps.gnuplot > #2074 > unrolled thread

Re: change line color when plot crosses Y value

Started by"A. W. Dunstan" <no@spam.thanks>
First post2011-02-03 12:02 -0500
Last post2011-02-03 12:14 -0800
Articles 4 — 2 participants

Back to article view | Back to comp.graphics.apps.gnuplot

This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by below is the oldest one visible, not the original post.


Contents

  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

#2074 — Re: change line color when plot crosses Y value

From"A. W. Dunstan" <no@spam.thanks>
Date2011-02-03 12:02 -0500
SubjectRe: change line color when plot crosses Y value
Message-ID<08CdncNFKaovQtfQnZ2dnUVZ_tCdnZ2d@speakeasy.net>
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

[toc] | [next] | [standalone]


#2080

Fromginginsman <dbh@suiattle.org>
Date2011-02-03 11:57 -0800
Message-ID<9caabf57-fe36-4a2d-90c4-022c70862df7@y31g2000prd.googlegroups.com>
In reply to#2074
On Feb 3, 6:02 pm, "A. W. Dunstan" <n...@spam.thanks> wrote:
> 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

OSX + Aqua doesn't offer wxt, so I guess I'll try out some others.

Many thanks!

[toc] | [prev] | [next] | [standalone]


#2092

From"A. W. Dunstan" <no@spam.thanks>
Date2011-02-04 10:00 -0500
Message-ID<VqWdneXc3rgMidHQnZ2dnUVZ_v-dnZ2d@speakeasy.net>
In reply to#2080
ginginsman wrote:

> On Feb 3, 8:57 pm, ginginsman <d...@suiattle.org> wrote:
>> On Feb 3, 6:02 pm, "A. W. Dunstan" <n...@spam.thanks> wrote:
>>
>>
>>
>>
>>
>> > 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
>>
>> 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
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

[toc] | [prev] | [next] | [standalone]


#2098

Fromginginsman <dbh@suiattle.org>
Date2011-02-03 12:14 -0800
Message-ID<c978ce90-a717-4f5e-95ff-98f338c4dfe9@m16g2000prc.googlegroups.com>
In reply to#2080
On Feb 3, 8:57 pm, ginginsman <d...@suiattle.org> wrote:
> On Feb 3, 6:02 pm, "A. W. Dunstan" <n...@spam.thanks> wrote:
>
>
>
>
>
> > 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
>
> 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.

[toc] | [prev] | [standalone]


Back to top | Article view | comp.graphics.apps.gnuplot


csiph-web