Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.graphics.apps.gnuplot > #2965 > unrolled thread
| Started by | thomas.lehmann.private@googlemail.com |
|---|---|
| First post | 2015-07-03 23:13 -0700 |
| Last post | 2015-07-07 18:24 +0200 |
| Articles | 4 — 4 participants |
Back to article view | Back to comp.graphics.apps.gnuplot
how to reference same data set in script twice? thomas.lehmann.private@googlemail.com - 2015-07-03 23:13 -0700
Re: how to reference same data set in script twice? Karl-Friedrich Ratzsch <mail.kfr@gmx.net> - 2015-07-05 02:23 +0200
Re: how to reference same data set in script twice? Ethan A Merritt <EAMerritt@gmail.com> - 2015-07-07 07:43 -0700
Re: how to reference same data set in script twice? Karl Ratzsch <mail.kfr@gmx.net> - 2015-07-07 18:24 +0200
| From | thomas.lehmann.private@googlemail.com |
|---|---|
| Date | 2015-07-03 23:13 -0700 |
| Subject | how to reference same data set in script twice? |
| Message-ID | <f2050fa4-92ed-46cb-8b25-9f3e50b39be8@googlegroups.com> |
Hi,
what I'm looking for is an elegant way to reference same
data twice (no file). I have a Python wrapper for plots and
the final script which result looks like (see bottom) ...
In this case we have two data sets. But how to do it when
I would like reference same data set twice without duplicating
the data set? (example: using for fit or displaying same data
with bars instead of lines - multiplot - or displaying modified
by a function ... there are plenty of variants)
One great solution would be if I could give a
data set a name. Possible? (again: no file wanted)
[code]
cat example.gp
#!/usr/bin/gnuplot
set terminal gif size 640, 480
set output "/tmp/example.gp.gif"
# displaying a plot title
set title "simple example"
# enables displaying a grid
set grid
# plotting values
plot\
"-" with lines ls 1 title "first curve",\
"-" with lines ls 2 title "second curve"
1 0
2 1
3 0
4 2
EOF
1 3
2 0
3 2
4 1
EOF
[/code]
[toc] | [next] | [standalone]
| From | Karl-Friedrich Ratzsch <mail.kfr@gmx.net> |
|---|---|
| Date | 2015-07-05 02:23 +0200 |
| Message-ID | <mn9teh$d1l$1@solani.org> |
| In reply to | #2965 |
Am 04.07.2015 um 08:13 schrieb thomas.lehmann.private@googlemail.com: > Hi, > > what I'm looking for is an elegant way to reference same > data twice (no file). I have a Python wrapper for plots and > the final script which result looks like (see bottom) ... Very simple if you have gp version > 5.0 set table $data plot "-" unset table fit ... $data ... plot $data, ...
[toc] | [prev] | [next] | [standalone]
| From | Ethan A Merritt <EAMerritt@gmail.com> |
|---|---|
| Date | 2015-07-07 07:43 -0700 |
| Message-ID | <mngogm$ku1$1@dont-email.me> |
| In reply to | #2966 |
Karl-Friedrich Ratzsch wrote: > Am 04.07.2015 um 08:13 schrieb thomas.lehmann.private@googlemail.com: >> Hi, >> >> what I'm looking for is an elegant way to reference same >> data twice (no file). I have a Python wrapper for plots and >> the final script which result looks like (see bottom) ... > > Very simple if you have gp version > 5.0 > > set table $data > plot "-" > unset table > fit ... $data ... > plot $data, ... I wouldn't recommend that, since the tabling operation only preserves some of the information in the original input stream. Much better is to use the version 5 "Here Document" method: $DATA_1 << EOD 1 2 3 # first line of data 3 4 5 8 9 EOD $DATA_2 << EOD 5 6 7 8 9 0 EOD plot $DATA_1 using 1:2, $DATA_1 using 1:3, $DATA_2
[toc] | [prev] | [next] | [standalone]
| From | Karl Ratzsch <mail.kfr@gmx.net> |
|---|---|
| Date | 2015-07-07 18:24 +0200 |
| Message-ID | <mngufb$rtn$1@solani.org> |
| In reply to | #2967 |
Am 07.07.2015 um 16:43 schrieb Ethan A Merritt: > Karl-Friedrich Ratzsch wrote: > >> Am 04.07.2015 um 08:13 schrieb thomas.lehmann.private@googlemail.com: >>> Hi, >>> >>> what I'm looking for is an elegant way to reference same >>> data twice (no file). I have a Python wrapper for plots and >>> the final script which result looks like (see bottom) ... >> >> Very simple if you have gp version > 5.0 >> >> set table $data >> plot "-" >> unset table >> fit ... $data ... >> plot $data, ... > > I wouldn't recommend that, since the tabling operation > only preserves some of the information in the original > input stream. Much better is to use the version 5 > "Here Document" method: > > > $DATA_1 << EOD > 1 2 3 # first line of data > 3 4 5 8 9 > EOD > > $DATA_2 << EOD > 5 6 7 > 8 9 0 > EOD > > plot $DATA_1 using 1:2, $DATA_1 using 1:3, $DATA_2 > That's right. If you already have a Python wrapper, there's no need to use table mode for filling $DATA. Definitely more elegant.
[toc] | [prev] | [standalone]
Back to top | Article view | comp.graphics.apps.gnuplot
csiph-web