Breaking an axis
Sometimes we would like to plot something over two disjoint domains, but want the plot to be contained in a single graph. In this case, we need to indicate that there is a discontinuity in the axis and generate two separate sets of tic marks, as shown in the following figure:
How to do it…
The following gnuplot script will produce the previous figure. It is provided with this book as a file called breaking_an_axis.gnuplot
. Run it with gnuplot breaking_an_axis.gnuplot to get a PNG file that should look just like the previous figure. If you don't have the pngcairo terminal installed, you can use the png terminal or anything you wish, but you may get a different pattern in the vertical box. Type test
at the gnuplot interactive prompt after setting your terminal (and output file if you are not using an interactive terminal) to see a list of the available patterns.
set term pngcairo font "Times,8" set out "plot.png" set border 2 set zeroaxis lt -1 set ytics axis nomirror set xtics...