|
From: <she...@be...> - 2010-05-19 21:44:50
|
Hi Gnuploteers I would like to be able to read a set of numbers contained at the beginning of a file and store the values in variables used in a GnuPlot script. Can this be done? If yes then how? Thanks again! |
|
From: Thomas S. <t.s...@fz...> - 2010-05-20 11:48:57
|
do a dummy plot to read the data in and assign the values to the variables inside the 'using' option. for more details please post information about how your data file looks like. SHELTRAW, DANIEL wrote: > > Hi Gnuploteers > > I would like to be able to read a set of numbers contained at the > beginning > of a file and store the values in variables used in a GnuPlot script. Can > this be done? If yes then how? > > Thanks again! > > > ------------------------------------------------------------------------------ > > _______________________________________________ > gnuplot-info mailing list > gnu...@li... > https://lists.sourceforge.net/lists/listinfo/gnuplot-info > > -- View this message in context: http://old.nabble.com/reading-file-data-into-variables-tp28614622p28620101.html Sent from the Gnuplot - User mailing list archive at Nabble.com. |
|
From: <she...@be...> - 2010-05-20 17:38:06
|
Hi Thomas A file would look something like this 19 27 22 43 67 70 12 76 19 102 43 78 93 23 67 9 28 56 Actually this pattern of two numbers on a line followed by a matrix of data would repeat throughout a larger file. What I need is to plot the matrix of data as a 2D image and label that image according to the two numbers contained on the line that precedes the matrix data. However I could change the format if it would help me achieve this. Thanks again for your help. > > do a dummy plot to read the data in and assign the values to > the variables inside the 'using' option. > > for more details please post information about how your data > file looks like. > > > SHELTRAW, DANIEL wrote: >> >> Hi Gnuploteers >> >> I would like to be able to read a set of numbers contained at the >> beginning >> of a file and store the values in variables used in a GnuPlot script. >> Can >> this be done? If yes then how? >> >> Thanks again! >> >> >> ------------------------------------------------------------------------------ >> >> _______________________________________________ >> gnuplot-info mailing list >> gnu...@li... >> https://lists.sourceforge.net/lists/listinfo/gnuplot-info >> >> > > -- > View this message in context: > http://old.nabble.com/reading-file-data-into-variables-tp28614622p28620101.html > Sent from the Gnuplot - User mailing list archive at Nabble.com. > > > ------------------------------------------------------------------------------ > > _______________________________________________ > gnuplot-info mailing list > gnu...@li... > https://lists.sourceforge.net/lists/listinfo/gnuplot-info > |
|
From: Thomas S. <t.s...@fz...> - 2010-05-21 14:29:41
|
it would be best, if you could insert 2 blank lines between two matrices, e.g.: datafile.dat: 19 27 22 43 67 70 12 76 19 102 43 78 93 23 67 9 28 56 17 24 12 33 47 50 22 46 39 42 33 58 23 33 47 19 18 26 then you would do the dummy plot to set the variables: set term push set term dumb plot 'datafile.dat' index 0 every ::0::0 using (a1=$1, a2=$2, 0/0):(0/0), \ '' index 1 every ::0::0 using (b1=$1, b2=$2, 0/0):(0/0) set term pop show variables # and now the matrix plots splot 'datafile.dat' matrix index 1 with linespoints, '' matrix index 3 with linespoints note that the 'index' numbering is different for normal and for matrix plots. to avoid this you could insert double blank lines between the numbers for reading into the variables and the matrices too. SHELTRAW, DANIEL wrote: > > Hi Thomas > > A file would look something like this > > 19 27 > > 22 43 67 70 > 12 76 19 102 > 43 78 93 23 > 67 9 28 56 > > Actually this pattern of two numbers on a line followed by a matrix of > data would repeat throughout a larger file. What I need is to plot the > matrix of data as a 2D image and label that image according to the two > numbers contained on the line that precedes the matrix data. However I > could change the format if it would help me achieve this. > > Thanks again for your help. > > >> >> do a dummy plot to read the data in and assign the values to >> the variables inside the 'using' option. >> >> for more details please post information about how your data >> file looks like. >> >> >> SHELTRAW, DANIEL wrote: >>> >>> Hi Gnuploteers >>> >>> I would like to be able to read a set of numbers contained at the >>> beginning >>> of a file and store the values in variables used in a GnuPlot script. >>> Can >>> this be done? If yes then how? >>> >>> Thanks again! >>> >>> >>> ------------------------------------------------------------------------------ >>> >>> _______________________________________________ >>> gnuplot-info mailing list >>> gnu...@li... >>> https://lists.sourceforge.net/lists/listinfo/gnuplot-info >>> >>> >> >> -- >> View this message in context: >> http://old.nabble.com/reading-file-data-into-variables-tp28614622p28620101.html >> Sent from the Gnuplot - User mailing list archive at Nabble.com. >> >> >> ------------------------------------------------------------------------------ >> >> _______________________________________________ >> gnuplot-info mailing list >> gnu...@li... >> https://lists.sourceforge.net/lists/listinfo/gnuplot-info >> > > > > ------------------------------------------------------------------------------ > > _______________________________________________ > gnuplot-info mailing list > gnu...@li... > https://lists.sourceforge.net/lists/listinfo/gnuplot-info > > -- View this message in context: http://old.nabble.com/reading-file-data-into-variables-tp28614622p28634613.html Sent from the Gnuplot - User mailing list archive at Nabble.com. |
|
From: <she...@be...> - 2010-05-21 17:24:44
|
Great! Thank you. > > it would be best, if you could insert 2 blank lines between > two matrices, e.g.: > > datafile.dat: > 19 27 > > 22 43 67 70 > 12 76 19 102 > 43 78 93 23 > 67 9 28 56 > > > 17 24 > > 12 33 47 50 > 22 46 39 42 > 33 58 23 33 > 47 19 18 26 > > then you would do the dummy plot to set the variables: > > set term push > set term dumb > plot 'datafile.dat' index 0 every ::0::0 using (a1=$1, a2=$2, 0/0):(0/0), > \ > '' index 1 every ::0::0 using (b1=$1, b2=$2, 0/0):(0/0) > set term pop > show variables > # and now the matrix plots > splot 'datafile.dat' matrix index 1 with linespoints, '' matrix index 3 > with > linespoints > > note that the 'index' numbering is different for normal and for matrix > plots. > to avoid this you could insert double blank lines between the numbers for > reading into the variables and the matrices too. > > > SHELTRAW, DANIEL wrote: >> >> Hi Thomas >> >> A file would look something like this >> >> 19 27 >> >> 22 43 67 70 >> 12 76 19 102 >> 43 78 93 23 >> 67 9 28 56 >> >> Actually this pattern of two numbers on a line followed by a matrix of >> data would repeat throughout a larger file. What I need is to plot the >> matrix of data as a 2D image and label that image according to the two >> numbers contained on the line that precedes the matrix data. However I >> could change the format if it would help me achieve this. >> >> Thanks again for your help. >> >> >>> >>> do a dummy plot to read the data in and assign the values to >>> the variables inside the 'using' option. >>> >>> for more details please post information about how your data >>> file looks like. >>> >>> >>> SHELTRAW, DANIEL wrote: >>>> >>>> Hi Gnuploteers >>>> >>>> I would like to be able to read a set of numbers contained at the >>>> beginning >>>> of a file and store the values in variables used in a GnuPlot script. >>>> Can >>>> this be done? If yes then how? >>>> >>>> Thanks again! >>>> >>>> >>>> ------------------------------------------------------------------------------ >>>> >>>> _______________________________________________ >>>> gnuplot-info mailing list >>>> gnu...@li... >>>> https://lists.sourceforge.net/lists/listinfo/gnuplot-info >>>> >>>> >>> >>> -- >>> View this message in context: >>> http://old.nabble.com/reading-file-data-into-variables-tp28614622p28620101.html >>> Sent from the Gnuplot - User mailing list archive at Nabble.com. >>> >>> >>> ------------------------------------------------------------------------------ >>> >>> _______________________________________________ >>> gnuplot-info mailing list >>> gnu...@li... >>> https://lists.sourceforge.net/lists/listinfo/gnuplot-info >>> >> >> >> >> ------------------------------------------------------------------------------ >> >> _______________________________________________ >> gnuplot-info mailing list >> gnu...@li... >> https://lists.sourceforge.net/lists/listinfo/gnuplot-info >> >> > > -- > View this message in context: > http://old.nabble.com/reading-file-data-into-variables-tp28614622p28634613.html > Sent from the Gnuplot - User mailing list archive at Nabble.com. > > > ------------------------------------------------------------------------------ > > _______________________________________________ > gnuplot-info mailing list > gnu...@li... > https://lists.sourceforge.net/lists/listinfo/gnuplot-info > |
|
From: <she...@be...> - 2010-05-21 18:34:20
|
Hi Gnuploteers How can I start a gnuplot script so that it puts all variables and the terminal into a known state? I am having trouble with getting different plot appearances the first time I run a script versus subsequent runs of the same script. Thanks again! |
|
From: Hans-Bernhard B. <HBB...@t-...> - 2010-05-21 18:51:30
|
she...@be... wrote: > How can I start a gnuplot script so that it puts all variables and the > terminal into a known state? You don't have to do anything to achieve that effect. Really. At the start of a gnuplot session all variables and settings _are_ in a known state. > I am having trouble with getting different > plot appearances the first time I run a script versus subsequent runs > of the same script. That's not a problem with the initial state of gnuplot, but rather with the state your script leaves gnuplot in. Those changes will affect gnuplot if you re-load the same script again. If you don't want that, put a 'reset' command at the start of your script, and set variables to the values you want them to have, at the start of the script. |
|
From: <she...@be...> - 2010-05-21 23:03:18
|
Reset. Thanks Hans. That fixed it. > she...@be... wrote: > >> How can I start a gnuplot script so that it puts all variables and the >> terminal into a known state? > > You don't have to do anything to achieve that effect. Really. At the > start of a gnuplot session all variables and settings _are_ in a known > state. > >> I am having trouble with getting different >> plot appearances the first time I run a script versus subsequent runs >> of the same script. > > That's not a problem with the initial state of gnuplot, but rather with > the state your script leaves gnuplot in. Those changes will affect > gnuplot if you re-load the same script again. If you don't want that, > put a 'reset' command at the start of your script, and set variables to > the values you want them to have, at the start of the script. > > |