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


Groups > comp.graphics.apps.gnuplot > #3442

Re: Varying colour of a line plot, using a palette

Path csiph.com!news.swapon.de!newsfeed.fsmpi.rwth-aachen.de!newsfeed.straub-nv.de!weretis.net!feeder4.news.weretis.net!feeder5.news.weretis.net!news.solani.org!.POSTED!not-for-mail
From Karl Ratzsch <mail.kfr@gmx.net>
Newsgroups comp.graphics.apps.gnuplot
Subject Re: Varying colour of a line plot, using a palette
Date Thu, 10 Nov 2016 13:37:24 +0100
Organization solani.org
Lines 21
Message-ID <o01pm4$q16$1@solani.org> (permalink)
References <e8j2gjFpuv0U1@mid.individual.net>
Mime-Version 1.0
Content-Type text/plain; charset=utf-8
Content-Transfer-Encoding 7bit
X-Trace solani.org 1478781444 26662 eJwNx8EBwEAEBMCWboM9ykHov4RkfmNCsK/SqLa24gZFvdMVQ5VyOV3I23/ICIg+KN88pyflAxL/EME= (10 Nov 2016 12:37:24 GMT)
X-Complaints-To abuse@news.solani.org
NNTP-Posting-Date Thu, 10 Nov 2016 12:37:24 +0000 (UTC)
User-Agent Mozilla/5.0 (Windows NT 6.1; WOW64; rv:45.0) Gecko/20100101 Thunderbird/45.4.0
X-User-ID eJwFwQERADEIAzBLPKxQ5PT24F/CEkR+eesk8mCxRKkH+3eDJdbYaNJBUmHcW+5GEyEG4wEVHBBp
X-NNTP-Posting-Host eJwFwYEBwCAIA7CXaqWMnYO4/n/CEu1cOU+kMmT50mwVLuBEVc+3cea0Ayap5sHC23Y0Z34jaRGT
Cancel-Lock sha1:CJ5g4i3TrFdYFWjTgd4QSDiDVaU=
In-Reply-To <e8j2gjFpuv0U1@mid.individual.net>
Xref csiph.com comp.graphics.apps.gnuplot:3442

Show key headers only | View raw


Am 10.11.2016 um 12:03 schrieb John Edwards:

> I was wondering if anyone can think of a neat trick to vary the color of 
> a line according to magnitude. E.g. If I plot sin(x) I'd like the color 
> to vary with signal matnitude.
> 
> To explain further what I am trying to do, I'd like to use a palette of 
> greens and reds so that when the signal goes over a threshold then the 
> plot would vary (slowly) from green to red to highlight specific issues.

Hm, very easy:

  set samp 800

  colourf(x) = (x<treshold) ? 0 : (x * 256) + (256 * (1-x) * 256)

  plot "+" us 1:(sin($1)):(colourf((sin($1)+1)/2)) w l lc rgb var lw 3

, where you define colourf(0<=x<1) so it returns a suitable 24 bit
integer, corresponding to the desired rgb colour.

Back to comp.graphics.apps.gnuplot | Previous | NextPrevious in thread | Next in thread | Find similar


Thread

Varying colour of a line plot, using a palette John Edwards <johned0@gmail.com> - 2016-11-10 11:03 +0000
  Re: Varying colour of a line plot, using a palette Karl Ratzsch <mail.kfr@gmx.net> - 2016-11-10 13:37 +0100
    Re: Varying colour of a line plot, using a palette Ethan A Merritt <sfeam@users.sourceforge.net> - 2016-11-10 15:36 -0800
      Re: Varying colour of a line plot, using a palette John Edwards <johned0@gmail.com> - 2016-11-11 10:24 +0000
  Re: Varying colour of a line plot, using a palette Karl Ratzsch <mail.kfr@gmx.net> - 2016-11-10 18:32 +0100
    Re: Varying colour of a line plot, using a palette John Edwards <johned0@gmail.com> - 2016-11-11 10:23 +0000

csiph-web