Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
985 views
in Technique[技术] by (71.8m points)

gnuplot angstrom label with Times-Roman font

I'm trying to produce a plot where I have the character ? (angstroms) in the x axis. Moreover, I want this character to be in the same font as the rest of the graph, that is I want to use Times-Roman. If I use the following code:

set encoding iso_8859_1
set term postscript eps enhanced color "Times-Roman, 32"
set output "angstroms.eps"
set xlabel "Try1  {A}  ({305})"
plot sin(x)

I obtain this figure: enter image description here

(note: the figure I get is in eps format, but I have to upload a jpg to stackoverflow)

If I remove the {A}, or change it into anything else like {B} I get this: enter image description here

Finally, if I write:

set xlabel "Try1   (/E {305})"

I get enter image description here where the ? symbol changed to sans serif font.

What's going on? Thanks for any help, Cheers!

/Luca

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

Here two different scripts, which work for me with Debian x86_64:

set encoding utf8 
set term postscript eps enhanced color "Times-Roman, 32"
set output "angstroms-utf8.eps"
set label at graph 0.1, graph 0.75 "Try1 {A} (?)"
set label at graph 0.1, graph 0.5 "Try1 {B} (?)"
set label at graph 0.1, graph 0.25 "Try1 (?)"
set xlabel "Try1 (?)"
plot sin(x)

I tested this one with 4.6.3 (needs at least 4.4 because of the utf8 encoding). As angstrom signs I used the LATIN CAPITAL LETTER A WITH RING ABOVE (U+00C5).

The other script is

set encoding iso_8859_1
set term postscript eps enhanced color "Times-Roman, 32"
set output "angstroms.eps"
set label at graph 0.1, graph 0.75 "Try1 {A} ({305})"
set label at graph 0.1, graph 0.5 "Try1 {B} ({305})"
set label at graph 0.1, graph 0.25 "Try1 ({305})"
set xlabel "Try1 ({305})"
plot sin(x)

That one I tested with 4.2.0 and 4.6.3. All variants give the same result:

enter image description here

I obtained that png using:

epstopdf angstroms-utf8.eps && pdftocairo -r 150 -png angstroms-utf8.pdf

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...