2013-10-02 119 views
3

我試圖產生一個情節,我在x軸上具有字符Å(angstroms)。此外,我希望這個角色與圖形的其餘部分處於相同的字體,也就是我想使用Times-Roman。如果我使用下面的代碼:gnuplot angstrom與Times-Roman字體的標籤

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) 

我得到這個數字: enter image description here

(注:圖中我得到的是EPS格式,但我要上傳JPG到計算器)

如果我刪除{A},或將其變成別的類似{B}我得到這個: enter image description here

最後,如果我寫:

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

我得到 enter image description here 其中Å符號改爲無襯線字體。

發生了什麼事?謝謝你的幫助,乾杯!

/盧卡

+0

我無法在Debian x86_64上用'gnuplot'版本4.6.0,4.6.3和4.7(2013-09-23)重現這一點。你還可以製作一個腳本和陰謀進行檢查。我在圖0.1使用'set label,圖0.75「Try1 {A}({\ 305})」;在圖0.1設置標籤,圖0.5「Try1 {B}({\ 305})」;在圖0.1上設置標籤,圖0.25「Try1({\ 305})」'。 – Christoph

+0

@Christoph我在有點舊的mac上使用gnuplot 4.2版本(Mac OS X 10.7.5)。如果我使用您的腳本,那只是圖形標籤,我可以在任何標籤上看到埃及標誌。但如果我使用最後一個也作爲xlabel,他們都消失了。我會嘗試在一個Linux機器上。 – Luca

+0

@Christoph我用gnuplot 4.6在linux上試過。如果除了標籤行之外,我還會添加'set xlabel「Try1({\ 305})」'。沒有標籤顯示任何Å標誌。 – Luca

回答

3

這裏,兩個不同的腳本,這對於我在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) 

我測試與4.6.3這一個(至少需要4.4因爲utf8編碼的)。由於埃爾符號我使用了LATIN CAPITAL LETTER A WITH RING ABOVE (U+00C5)

其他腳本

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) 

那一個我用4.2.0和4.6.3進行測試。所有變體產生相同的結果:

enter image description here

我獲得的png使用:

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

我想直接使用eps,但我沒有嘗試最簡單的形式,即直接輸入Å符號。它也適用於我。非常感謝! – Luca

0

在同時,我也發現了這個解決辦法,即使是不那麼優雅:

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