Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.graphics.apps.gnuplot > #4287
| Newsgroups | comp.graphics.apps.gnuplot |
|---|---|
| Date | 2020-01-30 08:53 -0800 |
| References | <67o8brF2n392sU1@mid.individual.net> <fv712b$s4s$1@sagnix.uni-muenster.de> |
| Message-ID | <6ad1397d-c998-4a1e-9c25-3dbc0757456c@googlegroups.com> (permalink) |
| Subject | Re: Variable for data column number? |
| From | andreas.buchgraitz@gmail.com |
tirsdag den 29. april 2008 kl. 13.33.31 UTC+2 skrev Juergen Wieferink: > Ingo Thies wrote: > > c1=1;c2=2 > > plot 'file' using c1:c2 > > > > But is it also possible to use variables for column numbers as a > > function argument? "$c1" or similar don't work. For now, I can only do > > this by replacing the column specifier in all the lines by > > search&replace, but a global switch would be much more convenient. > > This could be done using macros "help macro", but the clean way is > via the column() function (help column) [untested]: > > c1=1;c2=2 > plot 'file' using (column(c1)):(column(c2)) > > > Juergen Thanks, This works amazing if one wants to do math on each entry in a column, but directly in a bash script, for example subtracting some number from every entry: #!/bin/bash gnuplot <<-EOF set terminal pdf set output "test.pdf" plot "data.dat" u 1:(column(2)-2.63E-02) with lines EOF evince test.pdf
Back to comp.graphics.apps.gnuplot | Previous | Next | Find similar
Re: Variable for data column number? andreas.buchgraitz@gmail.com - 2020-01-30 08:53 -0800
csiph-web