Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Escaping special characters into titles/axis labels

179 views
Skip to first unread message

Martin Brown

unread,
Mar 19, 2021, 12:13:09 PM3/19/21
to
I'm new to gnuplot and find it very powerful but there are a couple of
fairly simple things that I just can't see how to do.

One is to escape in the greek symbol "alpha", "beta","theta" or "pi" or
equivalently to tell the axis scaling logic that I would like an axis to
scaled in fractions of pi. I can rename the variables but pi is well pi!

The compromise I have settled on for now is to plot the results on the
range -1 to 1 and label the axis as theta/pi since I don't know and
can't figure out how to escape it in. I tried \pi a la TeX.

I have also tried various suggestions I found online {/Symbol p} and I
do get an unprintable character displayed as a "?" but nothing more
terminal type is "qt" enhanced.

Thanks for any enlightenment on how to show Greek letters on graphs.

I was initially confused by the distinction when in mono mode between
set mono linetype and set linetype. It all worked OK once I remembered
to explicitly specify set mono linetype.

A few more distinct defined mono linetypes wouldn't go amiss in the
default distribution. 5 seems a bit mean given that they are a bit
tricky to alter. Seems to me when terminal is in mono mode the "mono"
linetype settings should be the ones that get changed by set linetype.

--
Regards,
Martin Brown

Karl Ratzsch

unread,
Mar 19, 2021, 3:59:31 PM3/19/21
to
Am 19.03.2021 um 17:13 schrieb Martin Brown:
> I'm new to gnuplot and find it very powerful but there are a couple
> of fairly simple things that I just can't see how to do.
>
> One is to escape in the greek symbol 'alpha', 'beta','theta' or 'pi'
> or equivalently to tell the axis scaling logic that I would like an
> axis to scaled in fractions of pi. I can rename the variables but pi
> is well pi!


The most straightforward method is to set all tics explicitly

set xtics pi ('pi/2' pi/2, 'pi' pi, '3pi/2' 3*pi/2, \
'2pi' 2*pi, '5pi/2' 5*pi/2, '3pi' 3*pi)
set grid
plot [0:3*pi] sin(x)

, you might use a "do for" loop to create the tics/labels as a macro
string. Alternatively you can just scale everything

set xtics .5 format '%hpi'
set grid
plot [0:3] sin(x*pi) title 'sin(x)'

. It could be nice to be able to add a piece of math containing the
axis variable to the format string, like with gprintf(). You can
post a feature request on gnuplot.sf.net

Use utf8 encoding ("set encoding utf8") to put in the pi symbol
(copy the greek symbols from a web page), or use one of the latex
terminals.

Hth!
Karl

Martin Brown

unread,
Mar 21, 2021, 5:32:39 AM3/21/21
to
Thank you for your very helpful explanation of how to do it.

--
Regards,
Martin Brown
0 new messages