Multiplots
The multiplot mechanism is used to combine the output of several plot or splot
commands into a single page or screen view. This mechanism has been reworked
extensively in gnuplot 6. Starting with version 6.0.5 interactive mousing is
possible in each panel of the combined view and the full multiplot can be
replotted using either the existing replot command or the new remultiplot
command. Multiplot mode is initiated by the command set multiplot and
continues until a closing unset multiplot.
- The set multiplot command saves the current graphics state into a new
datablock $GPVAL_PRE_MULTIPLOT and begins to record subsequent commands in a new datablock $GPVAL_LAST_MULTIPLOT.
- Each plot or splot command creates a new panel within the multiplot.
The position, size, axis ranges, and various other properties of each panel are saved for later use.
- After unset multiplot the two command datablocks and the per-panel data
are complete. Their content is not affected by subsequent gnuplot commands. At this point in an interactive session the full multiplot is showing on the screen. Mouse tracking uses the saved data to report appropriate coordinates and view angles for each panel if possible.
- The replot command will re-execute the commands in $GPVAL_LAST_MULTIPLOT.
It does not attempt to recreate the original graphics state, so the result may not exactly replicate the original figure. This is similar to using replot for a single plot in that you can deliberately change for example the fill style or starting axis ranges before issuing the replot command and the new settings will affect the redrawn figure.
- The remultiplot command is different. It first recreates the original
graphics state by loading the commands saved in $GPVAL_PRE_MULTIPLOT. It then re-executes the saved multiplot commands. This allows you to reproduce the original figure, perhaps for output to a different terminal. Unlike replot, any changes to the graphics settings made between the original multiplot and the remultiplot will probably be lost.
- If neither replot nor remultiplot is exactly suited to your use,
a customized sequence of commands can be used as shown below.
load $GPVAL_PRE_MULTIPLOT # restore original graphics settings
set style fill transparent # change just one setting
load #GPVAL_LAST_MULTIPLOT # re-execute the multiplot commands
[EXPERIMENTAL] Details may change. At this time several limitations apply.
- Certain saved commands that would be problematic during replay
are not reexecuted. These include reset, pause, and the definition of new data blocks.
- The saved per-panel data is not sufficient to interpret non-linear
axis mappings. The plot should display correctly but mouse tracking does not report coordinates.
- Mouse interaction tracks a maximum of 16 panels in a single multiplot.
If the multiplot contains more than 16 panels the additional panels will display correctly but are not mouseable. This limit may be removed in the future.
- Toggle plot on/off from the command line does not work for plots
in a multiplot.
- The commands "set terminal" and "set output" are not accepted
inside a multiplot.
- Inline data from a plot command using '-' as an input file is not saved,
so replotting or mousing will fail. To plot and save inline data, place the data in a named datablock. Example below.
$DATA << EOD
1 2 3
4 5 6
EOD
set multiplot
plot $DATA using 1:2 with points pt 5
plot $DATA using 1:3 with points pt 6
unset multiplot