linux - 使用命令行或 gnuplot 命令时,gnuplot 中的字体不同

标签 linux shell fonts gnuplot

我有一个包含一些命令的文件:

    $ cat components.plg
    set terminal png
    set output output
    set font "Helvetica,10"
    unset xtics
    unset ytics
    unset border
    plot "reportGraph_0" with lines title "Component 0", "reportGraph_1" with lines title "Component 1", "aoi.txt" with lines title "Area of interest"
    $

我不会在这里显示 reportGraph_# 的内容,但是任何包含 2 个点的内容都是有效的。

然后我用这个文件作为参数启动 gnuplot,我收到关于 Arial 的警告(我不完全确定为什么)。

    $ gnuplot -e "output='footprint.png' " components.plg 
    Could not find/open font when opening font "arial", using internal non-scalable font
    $

但是,结果图像的文本不是 Helvetica(但更多的是 Monospace sans)。

这是两个图像(第一个是命令行的输出,第二个是在 gnuplot shell 中启动的相同命令序列的输出,以及导出结果图像)。有一个区别,我没有在 gnuplot 中使用前两个命令(set terminal pngset output output)——我只是将图像“导出”为 png。 image from shell command line image from gnuplot commands

问题是:为什么我在这两张图片中没有相同的字体? 我想要 Helvetica(或 Lucida Grande,但不是等宽字体)。

最佳答案

Gnuplot 有各种各样的终端。当您启动交互式 gnuplot session 并绘图时,您可能会使用 wxtqt终端。通过从绘图窗口导出图像,您可以将图像保存为这些终端创建的图像。

现在,使用 set terminal png您使用一个不同的且非常旧的终端,具有不同的功能,尤其是在字体渲染方面。

如果您想将图像直接保存为 png,请使用 pngcairo终端,生成更高质量的图像(结果应该等同于从 wxt 导出的图像)。

pngcairo ,或 pdfcairo终端还应该正确处理您的字体。

关于linux - 使用命令行或 gnuplot 命令时,gnuplot 中的字体不同,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/40912188/

相关文章:

linux - 在/etc/environment文件中设置环境变量,值为 "#"字符

linux - 在 bash 中对一组关于日期范围的文件进行 grep

excel vba生成具有不同字体颜色的格式单元格

php - 删除奇怪的字体编码

html - Google 字体网站使用特殊字符,但网站不支持

linux kill命令-9 vs -15

c - 写入管道信号同步

linux - 在 Linux 中使用 TCP 套接字传输图像

linux - 如何在 Bash for 循环中同时访问两个数组索引以获取 curl 请求?

mysql - Bash 脚本将新的 MySql 服务器实例启动到内存中