Gnuplot - 显示调色板 palette 并设置打印 - 不打印消息“Color palette with x discrete colors saved to

Gnuplot - show palette palette and set print - do not print the message "Color palette with x discrete colors saved to

我正在使用 Python 生成 gnuplot 脚本。一些 Gnuplot 脚本创建具有颜色变化的图形(上面只有几个点)。我必须为其他图形重复使用相同的颜色。我发现可以使用命令

show palette palette <n>

获取与具有颜色变化的图形所使用的颜色对应的 RGB 值。因此,由于命令:

,我决定将值保存在文件中(稍后必须加载颜色时读取)
set print file.txt

一切正常,但我遇到打印问题:每次脚本将颜色值保存在文件中时,都会打印消息:

"Color palette with <x> discrete colors saved to <file.txt>"

我不想打印这条消息,因为我的主脚本执行许多这样的 gnuplot 脚本,屏幕上所有这些不重要的消息使得其他(更重要的)消息的查看变得复杂。

谁知道如何防止 gnuplot 打印此消息?

(我已经尝试更改标准输出:所有正常打印(其余代码的打印)不再可见,但 gnuplot 打印仍然出现)。

提前感谢您的帮助,

朱利安

在 Unix 系统上,您可以使用

启动 gnuplot
gnuplot 2>/dev/null

将发送到 stderr 的所有消息(如彩色消息)转储到 /dev/null,从而将它们从屏幕上删除。

但这也删除了所有错误消息。您不能有选择地仅删除颜色消息。