Skip to content

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 multiplot
wheel: zoom · drag: pan · right drag: box · a resetopen page ↗

Without 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 multiplot
wheel: zoom · drag: pan · right drag: box · a resetopen page ↗

Why it works ​

  • set multiplot layout ROWS,COLS lays out a grid; each plot fills the next panel, with the settings in force, so unset logscale y before the second plot affects that panel only. unset multiplot closes it.
  • with yerrorbars takes a third column, the error: x:y:dy (or x:y:low:high). xerrorbars and xyerrorbars work 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 (l unlinks them). Try a box zoom (right drag) on the residuals.
  • From Fortran, set_multiplot(rows, cols) and next_panel do 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' behind under 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 origin and set size under 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.

foresight is available under your choice of license: GPL-3.0-or-later, BSD-2-Clause, BSD-3-Clause or MIT (License).