Gnuplot Tips

Zoomable Gnuplot

There's a development version of gnuplot (3.8) that allows interactive zooming of 2D plots and rotating of 3D plots. I've installed a version on rosalind at /usr/local/bin/gnuplot if you want to check it out.

The instructions for compiling in this option (called "mouse support") are at

Here's the list of mouse and key commands available (you can also display this information by pressing "h" with the plot window in focus):

 <B1>               print coordinates to clipboard using `clipboardformat`
                    (see keys '3', '4')
 <B2>               annotate the graph using `mouseformat` (see keys '1', '2')
                    or draw labels if `set mouse labels is on`
 <Ctrl-B2>          remove label close to pointer if `set mouse labels` is on
 <B3>               mark zoom region (only for 2d-plots).
 <B1-Motion>        change view (rotation). Use <ctrl> to rotate the axes only.
 <B2-Motion>        change view (scaling). Use <ctrl> to scale the axes only.
 <Shift-B2-Motion>  vertical motion -- change ticslevel

 Space         raise gnuplot console window
 q             quit X11 terminal

 a             `builtin-autoscale` (set autoscale keepfix; replot)
 b             `builtin-toggle-border`
 e             `builtin-replot`
 g             `builtin-toggle-grid`
 h             `builtin-help`
 l             `builtin-toggle-log` y logscale for plots, z and cb logscale for splots
 L             `builtin-nearest-log` toggle logscale of axis nearest cursor
 m             `builtin-toggle-mouse`
 r             `builtin-toggle-ruler`
 1             `builtin-decrement-mousemode`
 2             `builtin-increment-mousemode`
 3             `builtin-decrement-clipboardmode`
 4             `builtin-increment-clipboardmode`
 5             `builtin-toggle-polardistance`
 6             `builtin-toggle-verbose`
 7             `builtin-toggle-ratio`
 n             `builtin-zoom-next` go to next zoom in the zoom stack
 p             `builtin-zoom-previous` go to previous zoom in the zoom stack
 u             `builtin-unzoom`
 Right         `builtin-rotate-right` only for splots; <shift> increases amount
 Up            `builtin-rotate-up` only for splots; <shift> increases amount
 Left          `builtin-rotate-left` only for splots; <shift> increases amount
 Down          `builtin-rotate-down` only for splots; <shift> increases amount
 Escape        `builtin-cancel-zoom` cancel zoom region

Plotting Dynamic Graphs with Gnuplot

This is an example of using the "reread" command in gnuplot to create dynamic plots. Dynamic plots can be created by using a driver gnuplot file and a gnuplot file containing the "plot" command that will continually be re-read.

We want to create a continually updating plot of the ping times to

Dynamic ifmon Plots

Gnuplot dynamic plotting can be used with ifmon (Don's tool for computing throughput). Multiple ifmon traces can be plotted on the same dynamic plot.

A script for generating these plots is located in DiRT space at


It takes as input a set of (ifmonfile label) sets. For example, ifmon is tracing TCP traffic to tcp.ifmon and another ifmon is tracing UDP traffic to udp.ifmon. To plot both on a dynamic plot, use

plot-dyn-ifmon tcp.ifmon "TCP" udp.ifmon "UDP"

Other DiRT documents
Author: Michele Weigle