|
View:
New views
3 Messages
—
Rating Filter:
Alert me
|
|
|
Print y-values at (local) extremesHello,
is there a way GNUplot to write y-values at places where the y-value is a (local) extreme? - Let's have a datafile with x and y values: # x y 1 5 2 6 3 8 4 4 8 11 10 10 Than the y(x) plot of these data will have local maximum at [2; 6] and [8; 11] and the local minimum at [4; 4]. And I'm looking for a way that GNUplot would write "6" and "11" above points of local maximums and "4" above the local minimum. Is it possible somehow? - I know special cases should be solved - e.g. data: 0 5 2 6 3 6 4 6 5 2 It should be decided whether the [2; 6], [3; 6] and/or [4; 6] are extremes as well; but this is not the main question. Or, is it possible the datafile to contain a special mark at points where the y-values are wanted to be written? E.g.: # x y 1 5 2 6 3 8 # y 4 4 # Y 8 11 # y 10 10 Which should mean: when plotting - "# y" => "write the y-value above", "# Y" => "write the y-value bellow"? See also the attachment for the wanted effect. Thank you in advance. Lukas Clipboard01.png |
|
|
Re: Print y-values at (local) extremesthe last case is 'easy':
plot "datafilename" with linespoints, \ "" using 1:2:(strlen("".stringcolumn(4)."")?("".stringcolumn(4)."" eq "Y")?stringcolumn(2):"":"") w labels offset 0,-1 rotate notitle, \ "" using 1:2:(strlen("".stringcolumn(4)."")?("".stringcolumn(4)."" eq "y")?stringcolumn(2):"":"") w labels offset 0,1 rotate notitle
|
|
|
Re: Print y-values at (local) extremestry this with gnuplot 4.3-cvs:
set xrange [0:11] set yrange [3:12] up=0 plot 'datafilename' with linespoints, \ '' using ($0==0?x1=x2=$1:($0==1?($2>=y1?up=1:up=0):0,x1=x2)):\ ($0==0?y1=y2=$2:y1=y2):\ ($0==0?0/0:0 , x2=$1 , y2=$2 , \ up==1?($2-y1<0?(up=0,sprintf("%d",y1)):0/0) \ :($2-y1>0?(up=1,0/0):0/0)) \ with labels offset 0,1 notitle , \ '' using ($0==0?x1=x2=$1:($0==1?($2>=y1?up=1:up=0):0,x1=x2)):\ ($0==0?y1=y2=$2:y1=y2):\ ($0==0?0/0:0 , x2=$1 , y2=$2 , \ up==1?($2-y1<0?(up=0,0/0):0/0) \ :($2-y1>0?(up=1,sprintf("%d",y1)):0/0)) \ with labels offset 0,-1 notitle
|
| Free embeddable forum powered by Nabble | Forum Help |