In this command line, <index_number> is used to mark the rectangle object, if we want to change the background color later it will be usefull, "from screen 0,0 to screen 1,1" means the rectangle is as large as the whole picture, <rgb-color> is the background color and "behind" put the rectangle behind all other elements of the picture，i.e., the lowest layer.
set object <index_number> rectangle \ from screen 0,0 to screen 1,1 fillcolor rgb"<rgb-color>" behind
Now let's have a look at an example script which produce two graphes with pink and light green background color respectively.
And pink.png and lightgreen.png are shown below:
reset #reset gnuplot options set term png font ",22" linewidth 3 #set terminal to png with fontsize=22,linewidth=3 set xlabel "x" #set xlable and ylabel set ylabel "y=sin(x)" #set a pink(#ffcccc) background color set object 1 rectangle from screen 0,0 to screen 1,1 fillcolor rgb"#ffcccc" behind set output "pink.png" plot sin(x) with lines linecolor rgb"green" notitle #set a light green(#ccffcc) background color set object 1 rectangle from screen 0,0 to screen 1,1 fillcolor rgb"#ccffcc" behind set output "lightgreen.png" plot sin(x) with lines linecolor rgb"red" notitle
|Pink background color|
|Light green background color|