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


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

Re: Plot 2D, from a file that contains blocked data every time x changes.

From Karl Ratzsch <mail.kfr@gmx.net>
Newsgroups comp.graphics.apps.gnuplot
Subject Re: Plot 2D, from a file that contains blocked data every time x changes.
Date 2017-03-12 11:28 +0100
Organization solani.org
Message-ID <oa37s8$ijk$1@solani.org> (permalink)
References <dd09bb03-a5be-49a7-90cb-1788eb6db4f4@googlegroups.com>

Show all headers | View raw


Am 11.03.2017 um 21:32 schrieb David Carrasco de Busturia:
> I have a data.dat file that looks like:
> 
> # z      y      x
> 25.04   12.50  10.00
> 24.01   11.30  10.00
> 25.03   12.50  10.00
> 22.01   14.20  10.00
> 
> 27.05   14.28  20.00
> 28.01   12.30  20.00
> 27.70   13.37  20.00
> 27.10   14.08  20.00

> Now, in the same gnuplot script, I would need to plot 2D graphs in which:
> 
> I plot the variation of z as a function of y for different values of x.

One graph with plot lines for x=10,20,etc. ?

plot for [i=1:10] dataf ev :::i::i using 2:1 w l

you can find out the number of data blocks in dataf with the "stats"
command. It is in the variable "STATS_blocks" afterwards. (Run "show
var STATS" to see all available statistics.)

Getting the value of x into the legend is a bit tricky. You cannot
use the stringcol() function in the "title" specifier, and it gets
(afaik) evaluated before any data is plotted, anyway.

So you need to read in the dataset twice, storing the relevant
information:

titlestr = ''
plot i=0, dataf us (n=column(-1), (n ==
i)?(titlestr=titlestr.stringcolumn(3).' ', i=i+1):0,$2):1

plot for [i=0:2] dataf ev :::i::i using 2:1 w l title word(titlestr,i+1)

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


Thread

Plot 2D, from a file that contains blocked data every time x changes. David Carrasco de Busturia <davidcarrascobustur@gmail.com> - 2017-03-11 12:32 -0800
  Re: Plot 2D, from a file that contains blocked data every time x changes. Karl Ratzsch <mail.kfr@gmx.net> - 2017-03-12 11:28 +0100
    Re: Plot 2D, from a file that contains blocked data every time x changes. Karl Ratzsch <mail.kfr@gmx.net> - 2017-03-12 11:29 +0100

csiph-web