

Once you have written something like “using 1:2”, the corresponding curve on the graph (the red one in Figure A) will use all the content of those columns…and nothing else, for the whole plot. As cool as they are, they also are sort of rigid. The green curve, instead, is the graphical representation of the function -2*(cos(3*x)*x) +1.įigure A shows the simplest kind of graphs that Gnuplot can draw. In that plot, the read line is drawn joining the points defined by the first two columns of the file: the first number of each row becomes the horizontal coordinate x, and the second the vertical one, y. The following command: plot "simpledata.txt" using 1:2 w l t "2nd column of data file", -2*(cos(3*x)*x) +1 w l If, for example, you have these numbers in a file called simpledata.txt: 1 -3 15 2 -2 14 3 -1.5 10 4 3 -9.5 5 2.75 -2.58

This week I’m going to spend a few words to introduce another Gnuplot feature that makes it an essential tool for everybody who needs automatic but flexible plotting.Īs you probably already know, Gnuplot can plot both mathematical functions and tabular data from ASCII files. Marco Fioretti goes over the finer points of using Gnuplot to design graphs based on mathematical functions and tabular data using conditional plotting.Ī couple of months ago, I showed on this blog one of the reasons why I like the command line plotting utility Gnuplot: its ability to understand and display in a very readable way time-based data.
GNUPLOT COLOR HOW TO
How to create conditional plotting with Gnuplot
