pipe plot data to gnuplot script

If you are on a Unix system (i.e. not Windows) you can use ‘<cat’ instead of ‘-‘ to read from stdin: plot ‘<cat’ using … Then you can do cat data.txt | gnuplot script.gp. However, in the specific case you mention in your question, with the plot in the for loop, you read the input … Read more

Add a single point at an existing plot

There are several possiblities to set a point/dot: 1. set object If you have simple points, like a circle, circle wedge or a square, you can use set object, which must be define before the respective plot command: set object circle at first -5,5 radius char 0.5 \ fillstyle empty border lc rgb ‘#aa1100’ lw … Read more

Hatch patterns in gnuplot

Suppose we want to pattern an area between function y=f(x) >0 and y = 0. It is posiible to create different “patterns” by using the following method. (i) Create a file that has 4 columns (x, y, xdelta, ydelta). This file describes a set of lines with the same slope. (ii) Plot data from the … Read more

Removing blank gap in gnuplot multiplot

Getting the margins right with multiplot is a bit tedious, especially when using set pm3d map, which has quite large margins. Since version 5.0 Since 5.0 version,multiplot has the options margins and spacing. margins takes four numbers set multiplot margins <left>,<right>,<bottom>,<top>, which give the fixed overall margins around the multiplot layout. spacing takes two number … Read more

Loop structure inside gnuplot?

There sure is (in gnuplot 4.4+): plot for [i=1:1000] ‘data’.i.’.txt’ using 1:2 title ‘Flow ‘.i The variable i can be interpreted as a variable or a string, so you could do something like plot for [i=1:1000] ‘data’.i.’.txt’ using 1:($2+i) title ‘Flow ‘.i if you want to have lines offset from each other. Type help iteration … Read more

Get ratio from 2 files in gnuplot

You cannot combine the data from two different files in a single using statement. You must combine the two files with an external tool. The easiest way is to use paste: plot ‘< paste a.dat b.dat’ using 1:($2/$4) with linespoints For a platform-independent solution you could use e.g. the following python script, which in this … Read more