Select Page

Adding labels

(Back to index page)

You can add labels at various parts of the graph.

A general label for the graph

Set label “Frequency (MHz)”

Label for x or y axis

Set xlabel “Frequency (MHz)”
Set ylabel “Amplitude (Volts)”

A random text/ in the graph area

set label 1 “DPPH Absorption spectrum” at 540,8000

Adding a label with values from a parameter

set label 1 sprintf(“m = %3.4f”,m) at 510,75 font “arialbd,18”

Adding a label with values from data fitting

set fit errorvariables
set label 1 sprintf(“m = %3.4f +/- %3.4f”, m, m_err) at 2,5 font “arialbd,18”

Adding symbols to the graph

To do this, you need to set the terminal to “enhanced”. Depending on whichever terminal that you used, you may be able to set it to enhanced.

Example:

  • set terminal windows enhanced
  • set terminal jpeg enhanced
  • set terminal postscript enhanced
  • set term wxt enhanced

By setting enhanced, you can add this code to add greek symbols:

set xlabel ” {/Symbol s}”  # this will add a sigma symbol

Here is the full list of symbols.

If your symbols are not appearing and this error appears instead:

gdImageStringFT: No character set found while printing string s with font Symbol
gdImageStringFT: No character set found while printing string s with font Symbol

Add this line of code, somewhere before your plot:

set encoding utf8

(Back to index page)