Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Gnuplot - change background color

Tags:

linux

svg

gnuplot

I used gnuplot to create a graph on linux. The script creates a svg file, but its background has black and white squares. How can I create a white and clear background? The script that 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 ""
like image 983
zakjma Avatar asked Dec 03 '14 10:12

zakjma


1 Answers

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

set terminal svg enhanced background rgb 'white'

If your gnuplot version doesn't yet support this option, you can place a full-canvas rectangle behind the plot

set object rectangle from screen 0,0 to screen 1,1 behind fillcolor rgb 'white' fillstyle solid noborder
...
plot x
like image 189
Christoph Avatar answered Sep 25 '22 14:09

Christoph