gpt4 book ai didi

gnuplot - gnuplot 中的 output.png 不如提示 shell 中的图好

转载 作者:行者123 更新时间:2023-12-03 06:09:40 26 4
gpt4 key购买 nike

我经常在 gnuplot 提示 shell 中绘制图表,如下所示:

gunuplot> plot sin(x) with linespoints pointtype 3

显示的数字很棒。

今天,我将图表保存在 .png 文件中,如下所示:

gnuplot> set term png
gnuplot> set output "output.png"
gunuplot> plot sin(x) with linespoints pointtype 3

然后,我在 Ubuntu 中使用 eog 打开 output.png,如下所示:

$ eog output.png

我发现,在eog中显示的output.png不如在prompt shell中绘制的图好。

这是为什么呢?在保存 output.png 之前我需要调整一些设置吗?

PS

我首先找到了解决方法,

set term postscript
set output "output.ps"

然后在Linux shell中,

$ convert output.ps output.jpg

这样可以解决我的问题。

最佳答案

PNG 质量问题的根源很可能是 Gnuplot 的 png 终端中缺少抗锯齿功能。由于您没有提供屏幕截图,所以我不确定您在谈论不良线宽时的意思,但这是我的情况(在 MacOS 上)。此屏幕截图显示了 gnuplot 的 native aquaterm 输出的输出:

A plot using gnuplot's native aquaterm output

如果我们使用set term png创建一个png,线条就会变得“跳跃”并且像素化:

The sine curve, plotted using the png terminal

但是,有一个 png 终端版本使用 Cairo 库进行渲染,这使得输出更加平滑和更好。 set term pngcairo 给出以下结果:

The sine curve, plotted using the pngcairo terminal

您可以使用setterminal来检查该终端版本是否适合您。如果是,这应该可以节省您的转换工作,并且还可以提供比 JPG 更好的图像质量(这不是线条艺术的理想格式)。

关于gnuplot - gnuplot 中的 output.png 不如提示 shell 中的图好,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/9080832/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com