gnuplot angstrom label with Times-Roman font

你说的曾经没有我的故事 提交于 2019-12-18 04:24:07

问题


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:

(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:

Finally, if I write:

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

I get

where the Å symbol changed to sans serif font.

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

/Luca


回答1:


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:

I obtained that png using:

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



回答2:


In the mean time I found also this workaround, even if it is not so elegant:

set xlabel 'Distance ~A{1{^\260}}'


来源:https://stackoverflow.com/questions/19141767/gnuplot-angstrom-label-with-times-roman-font

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!