Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.graphics.apps.gnuplot > #1657
| From | sfeam <sfeam@users.sourceforge.net> |
|---|---|
| Newsgroups | comp.graphics.apps.gnuplot |
| Subject | Re: Read values from file as input values |
| Followup-To | comp.graphics.apps.gnuplot |
| Date | 2013-02-19 13:02 -0800 |
| Organization | gnuplot development team |
| Message-ID | <kg0p80$9nv$1@dont-email.me> (permalink) |
| References | <6aa41d8a-c89b-4f4d-b2d6-cbd18a39c03f@googlegroups.com> |
Followups directed to: comp.graphics.apps.gnuplot
riehenringwg@gmail.com wrote:
> Hi
> I often come across the situation in which I want to specify the x,y-axes
> limits depending on the output-txt file that I get from simulations. More
> specifically: It would be very useful if there was a command that simply
> reads values from a .txt or .dat file and these values could be stored in
> variables specified in the gnuplot script (sth like dlmread in Matlab).
> I found a (not very elegant) way to do it anyway: plot the file, extract
> the limits of the axes via the GPVAL command and close the plot and replot
> with the appropriate limits. However, I wonder if there is a more elegant
> way (since here everything has to be plotted twice & a lot of windows open
> and close)? Thx in advance. riehen
Several suggestions come to mind.
1) gnuplot> XRANGE = system("cat xrange.txt")
gnuplot> XMIN = real(word(XRANGE,1))
gnuplot> XMAN = real(word(XRANGE,2))
gnuplot> set xrange [XMIN:XMAX]
2) Have the program that creates the file write an actual gnuplot command,
e.g. have the file contain
set xrange [123:456]
rather than
123 456
gnuplot> load "xrange.txt"
3) gnuplot> stats "simulation.out" using X:Y
gnuplot> set xrange [ stats_min_x : stats_max_x ]
Back to comp.graphics.apps.gnuplot | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
Read values from file as input values riehenringwg@gmail.com - 2013-02-19 04:27 -0800
Re: Read values from file as input values sfeam <sfeam@users.sourceforge.net> - 2013-02-19 13:02 -0800
Re: Read values from file as input values riehen <riehenringwg@gmail.com> - 2013-02-20 06:21 -0800
Re: Read values from file as input values riehen <riehenringwg@gmail.com> - 2013-02-20 06:22 -0800
csiph-web