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


Groups > comp.graphics.apps.gnuplot > #1656 > unrolled thread

Read values from file as input values

Started byriehenringwg@gmail.com
First post2013-02-19 04:27 -0800
Last post2013-02-20 06:22 -0800
Articles 4 — 3 participants

Back to article view | Back to comp.graphics.apps.gnuplot


Contents

  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

#1656 — Read values from file as input values

Fromriehenringwg@gmail.com
Date2013-02-19 04:27 -0800
SubjectRead values from file as input values
Message-ID<6aa41d8a-c89b-4f4d-b2d6-cbd18a39c03f@googlegroups.com>
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

[toc] | [next] | [standalone]


#1657

Fromsfeam <sfeam@users.sourceforge.net>
Date2013-02-19 13:02 -0800
Message-ID<kg0p80$9nv$1@dont-email.me>
In reply to#1656
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 ]

[toc] | [prev] | [next] | [standalone]


#1658

Fromriehen <riehenringwg@gmail.com>
Date2013-02-20 06:21 -0800
Message-ID<ca4296e4-757a-45c5-911a-3107b6d32243@googlegroups.com>
In reply to#1657
On Tuesday, February 19, 2013 10:02:44 PM UTC+1, sfeam wrote:
> 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 ]

thx sfeam. your 3rd suggestion did the trick for me! 


On Tuesday, February 19, 2013 10:02:44 PM UTC+1, sfeam wrote:
> 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 ]

thx sfeam. the 3rd suggestion did the trick for me. 

[toc] | [prev] | [next] | [standalone]


#1659

Fromriehen <riehenringwg@gmail.com>
Date2013-02-20 06:22 -0800
Message-ID<735c3f4b-b923-48aa-a866-9dba01428ce6@googlegroups.com>
In reply to#1657
On Tuesday, February 19, 2013 10:02:44 PM UTC+1, sfeam wrote:
> 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 ]



On Tuesday, February 19, 2013 10:02:44 PM UTC+1, sfeam wrote:
> 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 ]

thx sfeam. the 3rd suggestion did the trick for me!

[toc] | [prev] | [standalone]


Back to top | Article view | comp.graphics.apps.gnuplot


csiph-web