Differences
This shows you the differences between two versions of the page.
| Both sides previous revision Previous revision Next revision | Previous revision | ||
| software:gnuplot [2013/07/09 19:07] cyril [File outputs] | software:gnuplot [2024/04/19 09:54] (current) cyril autotitle | ||
|---|---|---|---|
| Line 59: | Line 59: | ||
| set x2label "" | set x2label "" | ||
| set y2label "" | set y2label "" | ||
| + | </ | ||
| + | |||
| + | * Log scale.< | ||
| + | set logscale x 2 | ||
| + | set logscale y 10 | ||
| </ | </ | ||
| Line 69: | Line 74: | ||
| set key left bottom | set key left bottom | ||
| set key 100,100 | set key 100,100 | ||
| + | </ | ||
| + | |||
| + | * Automatic legend.< | ||
| + | set key autotitle columnheader | ||
| </ | </ | ||
| Line 137: | Line 146: | ||
| * **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 172: | ||
| plot " | plot " | ||
| plot " | plot " | ||
| + | </ | ||
| + | |||
| + | * **palette** Colors as value.< | ||
| + | set palette defined (0 " | ||
| + | plot " | ||
| </ | </ | ||
| Line 190: | Line 208: | ||
| </ | </ | ||
| - | * **($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 225: | ||
| plot " | plot " | ||
| + | </ | ||
| + | |||
| + | * **word()** Define array variables.< | ||
| + | colors=" | ||
| + | print word(colors, | ||
| </ | </ | ||
| Line 214: | Line 241: | ||
| plot for [file in " | plot for [file in " | ||
| </ | </ | ||
| - | plot for [i=1:3] run.dat using i | + | plot for [i=1:3] run.dat using i t sprintf(" | 
| </ | </ | ||
| file(n) = sprintf(" | file(n) = sprintf(" | ||
| Line 277: | Line 304: | ||
| * 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 320: | ||
| </ | </ | ||
| ./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 455: | ||
| </ | </ | ||
| + | ===== 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 ===== | ||




