Path: csiph.com!optima2.xanadu-bbs.net!xanadu-bbs.net!feeder.erje.net!1.eu.feeder.erje.net!ecngs!feeder2.ecngs.de!46.4.82.166.MISMATCH!weretis.net!feeder1.news.weretis.net!news.solani.org!.POSTED!not-for-mail From: Karl Ratzsch Newsgroups: comp.graphics.apps.gnuplot Subject: Re: how to reference same data set in script twice? Date: Tue, 7 Jul 2015 18:24:08 +0200 Organization: solani.org Lines: 40 Message-ID: References: Mime-Version: 1.0 Content-Type: text/plain; charset=windows-1252 Content-Transfer-Encoding: 7bit X-Trace: solani.org 1436286251 28599 eJwNx8EBwCAIA8CVUCCWcRST/Uew97t0DPQKJCKV8ltdQOgvw1m97JOli6DNTR3wznL5sLPrARo1EUM= (7 Jul 2015 16:24:11 GMT) X-Complaints-To: abuse@news.solani.org NNTP-Posting-Date: Tue, 7 Jul 2015 16:24:11 +0000 (UTC) User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:38.0) Gecko/20100101 Thunderbird/38.0.1 X-User-ID: eJwFwYERACEIA7CVBNuC4/j9Y/8RTLgVckEUOJzArbUKmV6VteEYunJ+XXx0T2fKsHHQBw8AuBBC In-Reply-To: Cancel-Lock: sha1:GePcOi1VdBzbVi++fOiZ1xeeAm0= X-NNTP-Posting-Host: eJwFwQkBwDAIA0BLhCe0coBR/xJ2F0Zw0hn0ePH0YoiEbHtKXlZqg2slPpjv9inFrh22nIkfBbUQlA== X-Enigmail-Draft-Status: N1110 Xref: csiph.com comp.graphics.apps.gnuplot:2968 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.