gnuplot: italics in a portion of a label
Usually you can use the enhanced text mode to change the font for parts of a string:
set termoption enhanced
set xlabel "not italics, {/Times-Italic italics}"
Unfortunately, that behaviour is not supported by all terminals, see bold enhanced text in gnuplot and the related bug report #1240.
It works e.g. with the postscript
and png
terminals, but does not work with pngcairo
and pdfcairo
.
Related videos on Youtube
Memento Mori
I am an M.Sc. in computer science, specializing in bioinformatics. I generally write code in Perl, PHP, JQuery, Java or C++.
Updated on September 20, 2022Comments
-
Memento Mori over 1 year
Sorry for the (probably) basic question but I'm just getting started with gnuplot. What I'd like is to create an axis label with a portion of it in italics. Something like:
xlabel: Not italics, italics
I understand it's easy to set a label to display italics (set xlabel font "Times-Italic", 20), but is it possible to have only a portion of the label in italics?
-
Christoph over 10 yearsUnfortunately, that depends on the terminal. For
set terminal postscript eps enhanced
you can useset xlabel "not italics, {/Times-Italic italics}"
. But other terminals likepdfcairo
at the moment don't support font styles for the enhanced text mode, see also bold enhanced text in gnuplot. This was already reported as bug: sourceforge.net/p/gnuplot/bugs/1240.
-
-
Reid over 7 yearsYou can also use
{/:Italic foo}
to avoid re-specifying the font name. This works in Gnuplot 5, but I'm not sure if it's new. -
alfC almost 3 yearsWorks on pdf terminal too
-
Christoph almost 3 years@reid That was introduced with version 5 and is indeed the way to go nowadays