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


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

Re: Use variable from datafile in plot title

Path csiph.com!x330-a1.tempe.blueboxinc.net!newsfeed.hal-mli.net!feeder1.hal-mli.net!feeder.news-service.com!eternal-september.org!feeder.eternal-september.org!.POSTED!not-for-mail
From sfeam <sfeam@users.sourceforge.net>
Newsgroups comp.graphics.apps.gnuplot
Subject Re: Use variable from datafile in plot title
Followup-To comp.graphics.apps.gnuplot
Date Sun, 02 Oct 2011 10:00:42 -0700
Organization gnuplot development team
Lines 24
Message-ID <j6a5bt$747$1@dont-email.me> (permalink)
References <c760f4f3-806c-4422-875b-cce81debc830@k15g2000yqd.googlegroups.com>
Reply-To sfeam@users.sourceforge.net
Mime-Version 1.0
Content-Type text/plain; charset="ISO-8859-1"
Content-Transfer-Encoding 7Bit
Injection-Date Sun, 2 Oct 2011 17:00:45 +0000 (UTC)
Injection-Info mx04.eternal-september.org; posting-host="a5sqwvDD9P994JK/mw/xtg"; logging-data="7303"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX19BP89qOGoNJHtrMslbkmDs"
User-Agent KNode/4.4.9
Cancel-Lock sha1:8IsbbhSt99/8dqn4aejfdij1CCA=
Xref x330-a1.tempe.blueboxinc.net comp.graphics.apps.gnuplot:618

Followups directed to: comp.graphics.apps.gnuplot

Show key headers only | View raw


fcs pk wrote:

> Dear All,
> 
> I would like to use a variable from a data file as title for a plot.
> Something like:
> 
> var1 = './data_2' index 1000 using 4
> plot './data_1' index 1000 using 1:2 title var1
> 
> Well, obviously, the example I just gave doesnt work.  But I would
> like to know whether it is possible to do something similar in
> gnuplot? 

Suppose that somewhere in your file is a line like
# Next plot has title:     XX YY ZZ

You can use the string processing routines in gnuplot to get load
"XX YY ZZ" into a string variable:

gnuplot> grep_command = "grep title: myfile.dat"
gnuplot> titleline = system(grep_command)
gnuplot> index = strstrt(titleline, ": ")
gnuplot> plot_title = titleline[index+1:*]
gnuplot> plot .... title plot_tile

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


Thread

Use variable from datafile in plot title fcs pk <fcsprk@gmail.com> - 2011-10-02 06:53 -0700
  Re: Use variable from datafile in plot title sfeam <sfeam@users.sourceforge.net> - 2011-10-02 10:00 -0700

csiph-web