Path: csiph.com!weretis.net!feeder6.news.weretis.net!feeder5.news.weretis.net!news.solani.org!.POSTED!not-for-mail From: Karl Ratzsch Newsgroups: comp.graphics.apps.gnuplot Subject: Re: plot datafile with a blank between +- and some data Date: Wed, 3 Apr 2019 22:06:51 +0200 Organization: solani.org Lines: 56 Message-ID: References: Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Trace: solani.org 1554322009 6084 127.0.0.43 (3 Apr 2019 20:06:49 GMT) X-Complaints-To: abuse@news.solani.org NNTP-Posting-Date: Wed, 3 Apr 2019 20:06:49 +0000 (UTC) User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:60.0) Gecko/20100101 Thunderbird/60.6.1 Content-Language: de-DE-1901 X-User-ID: eJwFwQkBwDAIBDBL5fjlwAD/EpYoG9nnYmqip4eD5CaG8aKmvKl6xykJ3fciyjHLGtFFyB8f1hEr In-Reply-To: Cancel-Lock: sha1:hiTs0eEkyJpDAFoxG8tqU0O9Rxo= Xref: csiph.com comp.graphics.apps.gnuplot:4174 Am 03.04.2019 um 20:33 schrieb Jörg Buchholz: > On 03.04.19 08:38, Jörg Buchholz wrote: >> Hello, >> >> how can I plot the following data structure out of a file? >> >> 33,2019/03/21 10:00:06, 0,+ 6.786,+ 2.507 >> 34,2019/03/21 10:00:07, 0,+10.089,+ 5.564 >> 35,2019/03/21 10:00:08, 0,- 0.584,+ 3.324 >> 36,2019/03/21 10:00:09, 0,+10.156,+ 0.024 >> 37,2019/03/21 10:00:10, 0,+ 4.278,+ 5.439 >> 38,2019/03/21 10:00:11, 0,+ 0.431,+ 0.262 >> >> >> set datafile separator comma >> plot 'datafile' u 1:4 w p pt 7 >> >> gives only the values higher than 10 to me, cause there are no space >> between the sign and the value. >> >> How can I set the format correct to get all points? > > At the moment my solution is the following: > > system "sed -i 's/+ / +/g;s/- / -/g' datafile" > > Is there a solution to do it inside gnuplot? Possibly, but it will be very cumbersome. Putting a space between the sign and the decimal number is really a mean trick. "plot" can use a scanf() format specifier, but it cannot handle the date/time column, and only seven values in total, plus it would still stumble over the space in column 4. Be that as it may: $dat << EOD 33,2019/03/21 10:00:06, 0,+ 6.786,+ 2.507 34,2019/03/21 10:00:07, 0,+10.089,+ 5.564 35,2019/03/21 10:00:08, 0,- 0.584,+ 3.324 36,2019/03/21 10:00:09, 0,+10.156,+ 0.024 37,2019/03/21 10:00:10, 0,+ 4.278,+ 5.439 38,2019/03/21 10:00:11, 0,+ 0.431,+ 0.262 EOD set dataf sep "X" col1(st) = st[1:2] * 1.0 col4(st) = (st[28:28] eq "-" ? -1 : 1) * st[29:34] stcol(n) = stringcolumn(n) set table plot $dat us (col1(stcol(1))):(col4(stcol(1))) with table unset table