更新:此问题已在较新版本 (>5.0) 的 gnuplot 中解决;请参阅@andyras 的回答。
我很难让 gnuplot 在非 postscript 终端中创建带有粗体和增强文本的标签。下面的脚本
#!/usr/bin/env gnuplot
reset
set terminal pdfcairo enhanced color lw 3 size 3,2 font 'Arial-Bold'
set output 'output.pdf'
set tics scale 0
plot -x title 'normal text', \
-2*x t 'enhanced_{text}', \
-3*x t '{/Arial-Bold attempt to specify_{font}}'
set terminal pngcairo enhanced color lw 3 size 400,300 font 'Arial-Bold'
set output 'output.png'
replot
set terminal postscript enhanced color lw 3 size 6,4 font 'Arial-Bold'
set output 'output.eps'
replot
reset
生成以下 eps(使用
convert output.eps -rotate 90 outputeps.png
转换为 png):这很好。但是,当我使用 pdf 或 png 终端时,结果如下所示:
请注意,虽然所有标签文本都应为粗体,但只有没有任何增强文本的标签为粗体。此外,当我尝试手动指定字体(最后一行标题)时,字体是不同的(恢复为默认值?)。
不使用 postscript 终端时我应该期待这种行为吗?是否有另一种指定字体的方法(即在 postscript 之外命名方案是否不同)?
最佳答案
从 5.0 版开始,gnuplot 有一个新的语法来处理这个问题:
"normal text {/Times:Bold boldface-newfont} {/:Italic slanted-default-font } back to normal text"]
这些括号也可以嵌套。
关于gnuplot - gnuplot 中的粗体增强文本,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/16428338/