B1. A dashboard
Goal: one panel per quantity of the run, side by side: the residuals, and the drag coefficient with its error bars; then an inset that zooms on the last iterations.
gnuplot
set multiplot layout 1,2 title 'Run monitor'
set title 'residuals'
set logscale y; set grid
plot 'run.dat' u 1:2 t 'continuity', '' u 1:3 t 'momentum', '' u 1:4 t 'energy'
set title 'drag coefficient'
unset logscale y
plot 'run.dat' u 1:5:6 every 4 with yerrorbars pt 7 ps 0.5 t 'cd'
unset multiplotWithout layout, each panel lies in the box of its set origin and set size, page fractions: a zoom of the last iterations over the whole history.
gnuplot
set multiplot title 'Drag coefficient'
plot 'run.dat' u 1:5 w l t 'cd'
set origin 0.45,0.12; set size 0.5,0.45
unset key; set xrange [80:120]
plot 'run.dat' u 1:5:6 every 2 with yerrorbars pt 7 ps 0.5
unset multiplotWhy it works
set multiplot layout ROWS,COLSlays out a grid; eachplotfills the next panel, with the settings in force, sounset logscale ybefore the second plot affects that panel only.unset multiplotcloses it.with yerrorbarstakes a third column, the error:x:y:dy(orx:y:low:high).xerrorbarsandxyerrorbarswork the same way. The bar caps keep their size when you zoom.- In the page, the pointer picks the panel. Both panels plot iterations 0 to 120, so they share their x axis: a zoom on one shows the same iterations on the other, each keeping its own y (
lunlinks them). Try a box zoom (right drag) on the residuals. - From Fortran,
set_multiplot(rows, cols)andnext_paneldo the same (Fortran Library).
Try this
set multiplot layout 2,1 columnsfirst: the panels stacked, the x axes aligned under each other.set multiplot layout 1,2 margins 0.1,0.95,0.15,0.9 spacing 0.08: the plot areas lined up whatever the tick labels.- An inset with
set object 1 rectangle from screen 0.5,0.5 to screen 0.95,0.9 fc rgb 'white' behindunder it: a clean box.
Pitfalls
- Settings carry over from panel to panel, as in gnuplot: undo what the previous panel set (
unset logscale y). - Panels placed with
set originandset sizeunder a multiplot title start below the title band, not over it as gnuplot draws them (a documented difference).
Reference: multiplot, error bars. Next: B2. Watching the run.