Differences
This shows you the differences between two versions of the page.
Both sides previous revision Previous revision Next revision | Previous revision Next revision Both sides next revision | ||
software:gnuplot [2013/07/09 19:07] cyril [File outputs] |
software:gnuplot [2024/04/19 09:47] cyril [set] |
||
---|---|---|---|
Line 59: | Line 59: | ||
set x2label "" | set x2label "" | ||
set y2label "" | set y2label "" | ||
+ | </ | ||
+ | |||
+ | * Log scale.< | ||
+ | set logscale x 2 | ||
+ | set logscale y 10 | ||
</ | </ | ||
Line 137: | Line 142: | ||
* **every** Specifying lines to use (every 2 lines from line 50 to line 1050).< | * **every** Specifying lines to use (every 2 lines from line 50 to line 1050).< | ||
plot " | plot " | ||
+ | </ | ||
+ | |||
+ | * **separator** Set the field separator:< | ||
+ | set datafile separator "," | ||
</ | </ | ||
Line 159: | Line 168: | ||
plot " | plot " | ||
plot " | plot " | ||
+ | </ | ||
+ | |||
+ | * **palette** Colors as value.< | ||
+ | set palette defined (0 " | ||
+ | plot " | ||
</ | </ | ||
Line 190: | Line 204: | ||
</ | </ | ||
- | * **($1)** Arithmetics on columns.< | + | * **($1)** Arithmetics on columns |
plot " | plot " | ||
# where $n means column n | # where $n means column n | ||
+ | </ | ||
+ | |||
+ | * **(column())** Arithmetics on columns indices.< | ||
+ | plot i=1, " | ||
</ | </ | ||
Line 203: | Line 221: | ||
plot " | plot " | ||
+ | </ | ||
+ | |||
+ | * **word()** Define array variables.< | ||
+ | colors=" | ||
+ | print word(colors, | ||
</ | </ | ||
Line 277: | Line 300: | ||
* or anything else with shell commands... | * or anything else with shell commands... | ||
+ | |||
+ | * **fit** a function to data:< | ||
+ | f(x) = a*x**2 + b*x + c | ||
+ | fit f(x) " | ||
+ | plot " | ||
+ | </ | ||
* **sh** Passing arguments to a gnuplot script. | * **sh** Passing arguments to a gnuplot script. | ||
- | * Putting the gnuplot commands in a shell script (be careful, if you forget a backslash in front of a gnuplot dollar the error message can seem mysterious):< | + | * (preferred method) |
#!/bin/sh | #!/bin/sh | ||
ARGV1=$1 | ARGV1=$1 | ||
Line 287: | Line 316: | ||
</ | </ | ||
./plot.gp run.dat | ./plot.gp run.dat | ||
+ | </ | ||
+ | #!/bin/sh | ||
+ | ###### | ||
+ | script_header=`cat<< | ||
+ | set term wxt size 1024,768 | ||
+ | set grid | ||
+ | plot \ | ||
+ | EOF | ||
+ | ` | ||
+ | script=$script_header | ||
+ | ###### | ||
+ | for host in $*; do | ||
+ | script_loop=`cat<< | ||
+ | " | ||
+ | EOF | ||
+ | ` | ||
+ | script=" | ||
+ | done | ||
+ | ###### | ||
+ | script_footer=`cat<< | ||
+ | |||
+ | pause -1 | ||
+ | EOF | ||
+ | ` | ||
+ | script=" | ||
+ | |||
+ | gnuplot<< | ||
+ | $(echo " | ||
+ | EOF | ||
</ | </ | ||
* Writing a generic launcher script with environment variables (but difficulty to deal with relative paths):< | * Writing a generic launcher script with environment variables (but difficulty to deal with relative paths):< | ||
Line 393: | Line 451: | ||
</ | </ | ||
+ | ===== Interactivity ===== | ||
+ | |||
+ | * Keyboard bindings< | ||
+ | bind " | ||
+ | </ | ||
+ | |||
+ | * Progressive display (but the plot is not interactive anymore)< | ||
+ | plot " | ||
+ | while(1) { replot ; pause 0.2 } | ||
+ | </ | ||
+ | |||
+ | * Pausing and resuming the progressive display for interactivity (only works with x11 terminal if started in interactive gnuplot shell... for wxt terminal the event processing loop -- wxt_gui.cpp: | ||
+ | set terminal x11 | ||
+ | bind " | ||
+ | plot " | ||
+ | update=1 | ||
+ | while(update) { replot ; pause 0.2 } | ||
+ | </ | ||
===== Example ===== | ===== Example ===== |