User Tools

Site Tools


The Gnuplot syntax

Script: open by kate ~/ost4sem/exercise/basic_adv_gnuplot/
Data: ~/ost4sem/exercise/basic_adv_gnuplot/input.txt
Directory: ~/ost4sem/exercise/basic_adv_gnuplot

The gnuplot commands

The most important commands can grouped in two operations:

  • Setting the plotting environment by: set command.
  • Plotting the data by: plot and splot commands.


     plot {<ranges>}
          {<function> | {"<datafile>" {datafile-modifiers}}}
          {axes <axes>} {<title-spec>} {with <style>}
          {, {definitions,} <function> ...}

Here we will concentrate on commands for plotting data in 2D and 3D.

Enter in gnuplot by:


Plot standard function:

plot sin (x) 		

Plot your data:

plot 'input.txt'   u 3:4 

Query your data by AWK language:

plot "<awk '{if($2==2007) print $0 }'  input.txt " u 4:5

Plot two series of data in one plot:

plot "<awk '{if($2==2007) print $0 }'  input.txt " u 4:5, "<awk '{if($2==2005) print $0 }'  input.txt " u 4:5,

Sampling your data by AWK language:

# 2D plot
plot "<awk '{if (NR%100== 0) print $0}' aver_month_nuts3.asc " u 4:5
# 3D plot
splot "<awk '{if (NR%100== 0) print $0}' aver_month_nuts3.asc " u 4:5:7

Query your data by bash commands:

plot "< grep 2005  input.txt " u 4:5

Run a bash command inside gnuplot using the symbol !

! head input.txt

Call the bash shell inside gnuplot and return to gnuplot

head input.txt
wiki/gnuplotsintax.txt · Last modified: 2021/01/20 20:36 (external edit)