[英]gnuplot: making axes numbers smaller in epslatex makes my axes label disappear offscreen
我正在編寫一個腳本,以在一列中生成三個圖(使用多圖和設置邊距)。 它們都共享一個x軸,因此只需要在底部圖上進行標記,但是它們具有單獨的y軸。
我在gnuplot中使用epslatex終端生成帶有乳膠標簽和軸的圖。 基本上,我需要軸上的數字使用比實際軸標簽小的字體大小。 到目前為止,我一直在使用
reset
set term epslatex standalone color solid 10
set output 'myplot.tex'
set multiplot;
#Common width for all three plots is set
set lmargin at screen 0.15;
set rmargin at screen 0.90;
set format x ""; #Removes xlabels from plots without removing tic marks
#First plot
set tmargin at screen 0.98;
set bmargin at screen 0.72;
set ylabel '$Label Name 1$';
set format y '\scriptsize{%g}';
plot "mydata.dat" u 1:3 w l lt 1 lw 3
#Second plot
set tmargin at screen 0.70;
set bmargin at screen 0.44;
set ylabel '$Label Name 2$';
set format y '\scriptsize{%g}';
plot "mydata.dat" u 1:11 w l lt 2 lw 3
#Third plot
set tmargin at screen 0.42;
set bmargin at screen 0.16;
set xlabel 'Common Label Name';
set format x '\scriptsize{%g}'; # Here I reset the x axis so it shows on
this plot
set ylabel 'Label Name 3';
set format y '\scriptsize{%g}';
plot "mydata.dat" u 1:5 w l lt 3 lw 3
unset multiplot;
如您所見,我使用乳膠將數字設置為不同的大小,特別是\\ scriptsize。 對於最后的xlabel,一切正常。 數字以較小的字體顯示,並且xlabel以常規尺寸打印在其下方。 但是,對於ylabel,數字DO看起來較小,但實際標簽名稱未顯示在繪圖上。
最初我雖然並沒有以某種方式得到承認,但是當我嘗試使用頁邊距時,我發現如果將lmargin移到頁面中間,則ylabel會重新出現! 看起來,無論出於何種原因,它們都只是與軸本身相距很遠。
我試過設置帶有偏移量的標簽,但這並沒有帶來喜悅。
出現這種現象的原因是gnuplot不知道,使用LaTeX語法的tic最終看起來將如何。 程序嘗試估計tic標簽長度,並相應地調整標簽位置。
如果格式為'\\scriptsize %g'
,則tic標簽似乎很大:
set terminal epslatex standalone
set output 'label-offset.tex'
set format y '\scriptsize %g'
set ylabel 'ylabel'
plot x
set output
system('latex label-offset.tex && dvips label-offset.dvi && ps2pdf label-offset.ps')
Gnuplot版本4.2.6根本不考慮\\scriptsize
,您需要很大的偏移量來補償它: set ylabel 'ylabel' offset 14
。
由於versoin 4.4的行為更好,因此您需要一個低得多的偏移量: set ylabel 'ylabel' offset 4
。
一些說明:
\\scriptsize
是一個開關,不帶參數。 考慮set xlabel '\\scriptsize{scriptsize} normal?'
。 為了限制其效果,請在文本周圍加上方括號,例如{\\scriptsize %g}
。 但這並不是tic標簽的必要條件,因為它們總是放在括號中。
要使用斜體文字,請使用\\textit{label name 1}
,而不要使用帶有$
符號的數學模式。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.