10

I tried to do set yabel={/*2.0 MyLabel} based on the answer to this question, but that just printed the ylabel with those literals.

2 Answers 2

17

You can specify the font options simply by using the font argument like so:

set xlabel "x-units" font "Times-Roman,12"
set ylabel "y-units" font "Times-Roman,12"

Or you can just leave out either parameter, say for example if you want to set the font size but not the font face:

set xlabel "x-units" font ",12"
set ylabel "y-units" font ",12"

The official gnuplot documentation can be found here, and I'd also recommend checking out http://www.gnuplotting.org/

1
  • 1
    This looks much cleaner than the "{/*2 Ylabel}" stuff. Commented Jul 15, 2018 at 15:54
10

The terminal must have the enhanced option enabled, and your syntax for setting labels is wrong (without =). A working example:

set terminal pngcairo enhanced
set xlabel "Xlabel"
set ylabel "{/*2 Ylabel}"
set output 'fontsizetest.png'
plot x

Result: enter image description here

2
  • This solution does not work in the context of www.burningcutlery.com/derek/bargraph/ when I am trying to output to pdf. I tried to add "enhanced" to the set terminal line in his script, but this resulted in syntax error for gnuplot.
    – merlin2011
    Commented Aug 12, 2013 at 6:42
  • @merlin2011 The bargraph.pl script uses the fig terminal which does not support enhanced text (I don't know why).
    – Christoph
    Commented Aug 12, 2013 at 7:54

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.