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


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

Re: gnuplot conditional plotting with if column value is greater than 2.5

From Karl Ratzsch <mail.kfr@gmx.net>
Newsgroups comp.graphics.apps.gnuplot
Subject Re: gnuplot conditional plotting with if column value is greater than 2.5
Date 2017-11-27 14:17 +0100
Organization solani.org
Message-ID <ovh393$ndk$1@solani.org> (permalink)
References <f532384b-6919-4584-9b26-24a203713c1f@googlegroups.com>

Show all headers | View raw


Am 27.11.2017 um 00:16 schrieb dmngaya@gmail.com:
> Hi all,
> I have a data file with two columns like this:
> date avelp1219p01 avelp1219p02 avelp1219p03 avelp1219p04 
> 2017.11.12 1.9294 2.4847 1.7317 2.0424
> 2017.11.13 1.9451 2.49669 1.7477 1.99816 
> 2017.11.14 1.9451 2.49669 1.7477 1.99816 
> 2017.11.15 1.9451 2.49669 1.7477 1.99816 
> 2017.11.16 1.9451 2.49669 1.7477 1.99816 
> 2017.11.17 1.9451 2.49669 1.7477 1.99816
> I want to plot the colums value for avelp1219p01, avelp1219p02, avelp1219p03, avelp1219p04 if column value is greater than or equal 2.5.

You need the ternary operator (a ? b : c), which means "if a!=0 return
b, otherwise c"

plot dataf us (column("avelp1219") > 2.5 ? column("evelp1219") : NaN)

or

plot dataf us (val=column("evelp12"), val>2.5?val:NaN)

(latter uses the serial evaluation operator "," , to avoid having to
type in the column() function  twice)


Cheers, Karl

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


Thread

gnuplot conditional plotting with if column value is greater than 2.5 dmngaya@gmail.com - 2017-11-26 15:16 -0800
  Re: gnuplot conditional plotting with if column value is greater than 2.5 Karl Ratzsch <mail.kfr@gmx.net> - 2017-11-27 14:17 +0100

csiph-web