Example:
I want to plot a chart just like above one: a line with some missing data points, that means the line is discontinuous.
How can I do this?
To plot functions simply type: plot [function] at the gnuplot> prompt. Discrete data contained in a file can be displayed by specifying the name of the data file (enclosed in quotes) on the plot or splot command line. Data files should have the data arranged in columns of numbers.
gnuplot is a not-quite-as-easy-to use, though extremely powerful, command-line plotting program. Running gnuplot is easy: from a command prompt on any system, type gnuplot.
gnuplot can be used from various programming languages to graph data, including Perl (via PDL and other CPAN packages), Python (via gnuplotlib, Gnuplot-py and SageMath), R via (Rgnuplot), Julia (via Gaston.
gnuplot is a command-driven interactive function plotting program. It can be used to plot functions and data points in both two- and three- dimensional plots in many different formats. It is designed primarily for the visual display of scientific data.
This depends on what your datafile looks like. If you insert a blank space in your datafile, it won't connect those adjacent points (This is the easiest way):
consider:
#datafile
1 2
2 3
4 2
5 3
and then the script to plot it:
plot 'datafile' u 1:2 w linespoints
There are other tricks you can play with missing data: set datafile missing
. A good reference for this is the builtin help (help missing
).
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With