gnuplot png白色黑色

Pau*_*aul 5 png gnuplot

在gnuplot-4.2.6中,我可以使用黑色图像生成漂亮的白色

set term png medium x000000 xffffff
set output 'file.png'
plot x
Run Code Online (Sandbox Code Playgroud)

这将生成一个带有黑色背景和白轴,轴标签,标题,图例文本等的png文件.

新的gnuplot-5.0.1抱怨上面的'set term'命令说"过时的颜色选项".我最接近获得黑色白色的图像是将背景设置为黑色

set term png medium background '#ffffff'
set output 'file.png'
plot x
Run Code Online (Sandbox Code Playgroud)

但这只是将背景设置为黑色而不将轴,轴标签等设置为白色.

有没有人知道如何在最新版本的gnuplot中获得黑色png图像的白色?

Chr*_*oph 7

png终端的这些颜色选项已从版本4.6中删除.日志说明了这一点:除了设置背景颜色外,这种机制完全过时了.

自版本4.6.0,你可以(也必须)设置linecolortextcolor各部分明确地的:

set terminal pngcairo background rgb 'black'
set xlabel 'ylabel' tc rgb 'white'
set ylabel 'xlabel' tc rgb 'white'
set border lc rgb 'white'
set key tc rgb 'white'

set linetype 1 lc rgb 'white'
set output 'bw.png'
plot x lc 1, x**2 lc 1
Run Code Online (Sandbox Code Playgroud)

在此输入图像描述

如果您只需要某些图片的设置,您可以将几个部分移动到某种配置文件`black-and-white.gp'与内容

set macros
bg = 'background rgb "black"'
white = 'textcolor rgb "white"'
set xlabel @white
set ylabel @white
set linetype 11 lc rgb 'white'
set border lc 11
set key @white
Run Code Online (Sandbox Code Playgroud)

在实际的绘图文件中,您可以使用它

load 'black-and-white.gp'
set terminal pngcairo @bg
set xlabel 'xlabel'
set ylabel 'ylabel'

set output 'bw.png'
plot x lc 11, x**2 lc 11
Run Code Online (Sandbox Code Playgroud)