Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.graphics.apps.gnuplot > #4171 > unrolled thread
| Started by | Jörg Buchholz <bookwood4new@freenet.de> |
|---|---|
| First post | 2019-04-03 08:38 +0200 |
| Last post | 2019-04-04 23:47 +0200 |
| Articles | 5 — 2 participants |
Back to article view | Back to comp.graphics.apps.gnuplot
plot datafile with a blank between +- and some data Jörg Buchholz <bookwood4new@freenet.de> - 2019-04-03 08:38 +0200
Re: plot datafile with a blank between +- and some data Jörg Buchholz <bookwood4new@freenet.de> - 2019-04-03 20:33 +0200
Re: plot datafile with a blank between +- and some data Karl Ratzsch <mail.kfr@gmx.net> - 2019-04-03 22:06 +0200
Re: plot datafile with a blank between +- and some data Jörg Buchholz <bookwood4new@freenet.de> - 2019-04-04 10:10 +0200
Re: plot datafile with a blank between +- and some data Karl Ratzsch <mail.kfr@gmx.net> - 2019-04-04 23:47 +0200
| From | Jörg Buchholz <bookwood4new@freenet.de> |
|---|---|
| Date | 2019-04-03 08:38 +0200 |
| Subject | plot datafile with a blank between +- and some data |
| Message-ID | <q81kck$ifh$1@dont-email.me> |
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? thanks Jörg
[toc] | [next] | [standalone]
| From | Jörg Buchholz <bookwood4new@freenet.de> |
|---|---|
| Date | 2019-04-03 20:33 +0200 |
| Message-ID | <q82uah$dg1$1@dont-email.me> |
| In reply to | #4171 |
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? Jörg
[toc] | [prev] | [next] | [standalone]
| From | Karl Ratzsch <mail.kfr@gmx.net> |
|---|---|
| Date | 2019-04-03 22:06 +0200 |
| Message-ID | <q833op$5u4$1@solani.org> |
| In reply to | #4172 |
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
[toc] | [prev] | [next] | [standalone]
| From | Jörg Buchholz <bookwood4new@freenet.de> |
|---|---|
| Date | 2019-04-04 10:10 +0200 |
| Message-ID | <q84e5s$i2f$1@dont-email.me> |
| In reply to | #4174 |
On 03.04.2019 22:06, Karl Ratzsch wrote: > 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. It is a .csv file that comes from a "Graphtec GL240 midi Data Logger". > "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 Thanks for your solution. There are some more columns. So I think, for me, it is easer do handle the datafile with sed. From inside gnuplot or direct after the files where produced. Jörg
[toc] | [prev] | [next] | [standalone]
| From | Karl Ratzsch <mail.kfr@gmx.net> |
|---|---|
| Date | 2019-04-04 23:47 +0200 |
| Message-ID | <q85u1t$1vn$1@solani.org> |
| In reply to | #4175 |
Am 04.04.2019 um 10:10 schrieb Jörg Buchholz: > On 03.04.2019 22:06, Karl Ratzsch wrote: >> 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 > > > Thanks for your solution. There are some more columns. So I think, for > me, it is easer do handle the datafile with sed. Me too. If the format is not totally fixed like in your example, this becomes bedlam with gnuplot string evaluation. Certainly possible, but it is probably easier to learn regular expressions. :-)
[toc] | [prev] | [standalone]
Back to top | Article view | comp.graphics.apps.gnuplot
csiph-web