Formatting tic labels

gnuplot provides a great deal of flexibility in the formatting of numbers in tic labels and allows us to freely intermix text with its automatically generated numbers. This is illustrated in the following figure:

Formatting tic labels

How to do it…

The following script introduces the formatting commands that we used to produce the previous figure:

set ylabel "Output power"
set format y "P = %.2f Watts"
set format x "%.3f%%"
set rmargin 6
plot [0:100] x**2

How it works…

The new commands are in the highlighted lines. set format y and set format x define the formats to be used for the tic labels on the y and x-axes, respectively. For a complete rundown ...

Get gnuplot Cookbook now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.