Gnuplot png white on black
In gnuplot-4.2.6, I can create a nice white on black image with
set term png medium x000000 xffffff
set output 'file.png'
plot x
This creates a png file with black background and white axes, axis axes, titles, legend text, etc.
The new gnuplot-5.0.1 complains about the aforementioned "set term" command saying "deprecated color option". The closest I can get to have an image white on black is to set the background to black with
set term png medium background '#ffffff'
set output 'file.png'
plot x
but this just sets the background to black without setting the axes, axis labels, etc. to white.
Does anyone know how I can get white black png images in the latest version of gnuplot?
source to share
These color options for the png terminal have been removed with version 4.6. The magazine says this: This mechanism is completely deprecated, except for setting the background color .
Starting with version 4.6.0, you can (but should also) set linecolor
, and textcolor
for each part:
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
If you only need these settings for some images, you can move a few parts to some config file `black-and-white.gp 'with content
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
In the actual plot file, you use it like
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
source to share