|
From: Jeremy C. <jer...@gm...> - 2009-06-03 17:38:24
|
I have a file containing all my data. I can easily plot that data. I need to store the first data point in a particular column so I can place a label at that point. Can someone show me how to do this? Small example: # ---------------------------------- x1 = # Get data from file y1 = 1.0 set label "Hello" at x1, y1 right # ----------------------------------- Thanks, Jeremy |
|
From: Thomas S. <t.s...@fz...> - 2009-06-04 09:06:33
|
get 1st data of column 3:
x1 = system("head -n1 datafilename | cut -d ' ' -f 3")
or
x1 = system("head -n1 ts.dat | awk '{print $3}'")
or with gnuplot 4.3-cvs:
set table
plot 'datafilename' us 0:($0==0?(x1=$3):$3)
unset table
Jeremy Conlin wrote:
>
> I have a file containing all my data. I can easily plot that data. I
> need
> to store the first data point in a particular column so I can place a
> label
> at that point. Can someone show me how to do this?
> Small example:
> # ----------------------------------
> x1 = # Get data from file
> y1 = 1.0
>
> set label "Hello" at x1, y1 right
> # -----------------------------------
>
> Thanks,
> Jeremy
> ------------------------------------------------------------------------------
> OpenSolaris 2009.06 is a cutting edge operating system for enterprises
> looking to deploy the next generation of Solaris that includes the latest
> innovations from Sun and the OpenSource community. Download a copy and
> enjoy capabilities such as Networking, Storage and Virtualization.
> Go to: http://p.sf.net/sfu/opensolaris-get
> _______________________________________________
> Gnuplot-info mailing list
> Gnu...@li...
> https://lists.sourceforge.net/lists/listinfo/gnuplot-info
>
>
--
View this message in context: http://www.nabble.com/Storing-point-from-data-file-in-variable-tp23855912p23866304.html
Sent from the Gnuplot - User mailing list archive at Nabble.com.
|
|
From: Jeremy C. <jer...@gm...> - 2009-06-04 13:59:29
|
On Thu, Jun 4, 2009 at 5:06 AM, Thomas Sefzick <t.s...@fz...>wrote:
>
> get 1st data of column 3:
>
> x1 = system("head -n1 datafilename | cut -d ' ' -f 3")
> or
> x1 = system("head -n1 ts.dat | awk '{print $3}'")
>
> or with gnuplot 4.3-cvs:
>
> set table
> plot 'datafilename' us 0:($0==0?(x1=$3):$3)
> unset table
>
I do have gnuplot 4.3 and that command sets x1 to the value I want. But
it's rather cryptic. Can you tell me what everything means or point me
toward the documentation explaining it?
Thanks,
Jeremy
|
|
From: Thomas S. <t.s...@fz...> - 2009-06-04 15:58:02
|
starting with gnuplot 4.3-cvs there are new operators
'=' and ',' in expression syntax, that means, one can use
them for the 'using' modifier inside a 'plot' command.
defining labels must be done before plotting, but access
to the data you don't have before plotting, so filling a variable
with some value from the datafile can only be done
when plotting (but then it's too late to define a label).
one solution is to do a dummy plot by plot 'nothing to
nowhere', by doing this you can set the variable.
(plotting to nowhere can be done by specifying
'set out "/dev/null"' on unix systems, or, plotting
nothing can be done by printing a table to
the terminal window or text window)
then you define the title, label, ....
and afterwards you do the real plot.
gnuplot> set table
gnuplot> plot 'datafilename' us 0:($0==0?(x1=$3):$3)
gnuplot> unset table
for explanation of the syntax see
gnuplot> help table
gnuplot> help ternary
gnuplot> help using
gnuplot> help using pseudocolumns
Jeremy Conlin wrote:
>
> On Thu, Jun 4, 2009 at 5:06 AM, Thomas Sefzick
> <t.s...@fz...>wrote:
>
>>
>> get 1st data of column 3:
>>
>> x1 = system("head -n1 datafilename | cut -d ' ' -f 3")
>> or
>> x1 = system("head -n1 ts.dat | awk '{print $3}'")
>>
>> or with gnuplot 4.3-cvs:
>>
>> set table
>> plot 'datafilename' us 0:($0==0?(x1=$3):$3)
>> unset table
>>
> I do have gnuplot 4.3 and that command sets x1 to the value I want. But
> it's rather cryptic. Can you tell me what everything means or point me
> toward the documentation explaining it?
>
> Thanks,
> Jeremy
> ------------------------------------------------------------------------------
> OpenSolaris 2009.06 is a cutting edge operating system for enterprises
> looking to deploy the next generation of Solaris that includes the latest
> innovations from Sun and the OpenSource community. Download a copy and
> enjoy capabilities such as Networking, Storage and Virtualization.
> Go to: http://p.sf.net/sfu/opensolaris-get
> _______________________________________________
> Gnuplot-info mailing list
> Gnu...@li...
> https://lists.sourceforge.net/lists/listinfo/gnuplot-info
>
>
--
View this message in context: http://www.nabble.com/Storing-point-from-data-file-in-variable-tp23855912p23872826.html
Sent from the Gnuplot - User mailing list archive at Nabble.com.
|
|
From: Jeremy C. <jer...@gm...> - 2009-06-04 16:49:01
|
On Thu, Jun 4, 2009 at 11:57 AM, Thomas Sefzick <t.s...@fz...>wrote: > > starting with gnuplot 4.3-cvs there are new operators > '=' and ',' in expression syntax, that means, one can use > them for the 'using' modifier inside a 'plot' command. > > defining labels must be done before plotting, but access > to the data you don't have before plotting, so filling a variable > with some value from the datafile can only be done > when plotting (but then it's too late to define a label). > > one solution is to do a dummy plot by plot 'nothing to > nowhere', by doing this you can set the variable. > (plotting to nowhere can be done by specifying > 'set out "/dev/null"' on unix systems, or, plotting > nothing can be done by printing a table to > the terminal window or text window) > then you define the title, label, .... > and afterwards you do the real plot. > > gnuplot> set table > gnuplot> plot 'datafilename' us 0:($0==0?(x1=$3):$3) > gnuplot> unset table > > for explanation of the syntax see > gnuplot> help table > gnuplot> help ternary > gnuplot> help using > gnuplot> help using pseudocolumns Thank you for that great information. I'll look up those help topics and if I have any questions, I'll post them here. Jeremy |