Search code examples
plotgnuplot

Symbols in Gnuplot label


Code in terminal qt and gnuplot 5.0

plot x; set xlabel 'Magnetic field {/Symbol Mu}_0'

which works in gnuplot prompt. However, {/Symbol mu}_0 is not working in Commandline script

`/usr/local/bin/gnuplot -e "plot x; set xlabel 'Magnetic field {/Symbol m}_0 H / mT'`;

I get

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

How can you write the symbol with underscore in gnuplot label?


Solution

  • To get µ character with subscript zero, use either a utf8-encoded label

    gnuplot -p -e "set encoding utf8; set xlabel 'Magnetic field µ₀ H / mT'; plot x"
    

    or

    gnuplot -p -e "set xlabel 'Magnetic field {/Symbol m}_0 H / mT'; plot x"