Gnuplot - change background color

I used gnuplot to create a graph on linux. The script creates the svg file, but its background has black and white squares. How to create a white and clear background? The script I used is below:

set terminal svg enhanced size 1000 1000 fname "Times" fsize 36 set autoscale set output "plot.svg" set title "A simple plot of x^2 vs. x" set xlabel "x" set ylabel "y" plot "./data.dat" using 1:2 title "" 
+7
linux svg gnuplot
source share
1 answer

These black and white squares are inserted by the viewer and indicate that you actually have no background. To get a white background, use the background option:

 set terminal svg enhanced background rgb 'white' 

If your version of gnuplot does not yet support this option, you can place a rectangle with a full canvas behind the chart

 set object rectangle from screen 0,0 to screen 1,1 behind fillcolor rgb 'white' fillstyle solid noborder ... plot x 
+11
source share

All Articles