Gnuplot can read png binary file and then plot it on the canvas. Using this utility we can add a background image to our plot. Let us see an example script.
reset
set term png set output "world_population.png" set multiplot set xrange [0:799] set yrange [0:409] #As the background picture's size is 800x410, #we choose xrange and yrange of these values unset tics unset border set lmargin at screen 0.175 set rmargin at screen 0.9 set bmargin at screen 0.15 set tmargin at screen 0.9 #Plot the background image plot "map.png" binary filetype=png w rgbimage #The x and y range of the population data file set xrange [1740:2020] set yrange [0:7000] set border set tics out nomirror scale 2 set mxtics 5 set key left set xlabel "Year" set ylabel "Population(in millions)" plot "population.dat" u 1:2 w lp lw 2 ps 1 pt 7 title "world",\ "population.dat" u 1:3 w lp lw 2 ps 1 pt 7 title "Africa",\ "population.dat" u 1:4 w lp lw 2 ps 1 pt 7 title "Asia",\ "population.dat" u 1:5 w lp lw 2 ps 1 pt 7 title "Europe",\ "population.dat" u 1:6 w lp lw 2 ps 1 pt 7 title "Katub America",\ "population.dat" u 1:7 w lp lw 2 ps 1 pt 7 title "Northern America",\ "population.dat" u 1:8 w lp lw 2 ps 1 pt 7 title "Oceania" unset multiplot
#Data from http://en.wikipedia.org/wiki/World_population #Year World Africa Asia Europe Latin America Northern America Oceania 1750 791 106 502 163 16 2 2 1800 978 107 635 203 24 7 2 1850 1262 111 809 276 38 26 2 1900 1650 133 947 408 74 82 6 1950 2519 221 1398 547 167 172 12.8 1955 2756 247 1542 575 191 187 14.3 1960 2982 277 1674 601 209 204 15.9 1965 3335 314 1899 634 250 219 17.6 1970 3692 357 2143 656 285 232 19.4 1975 4068 408 2397 675 322 243 21.5 1980 4435 470 2632 692 361 256 22.8 1985 4831 542 2887 706 401 269 24.7 1990 5263 622 3168 721 441 283 26.7 1995 5674 707 3430 727 481 299 28.9 2000 6070 796 3680 728 520 316 31.0 2005 6454 888 3917 725 558 332 32.9 2008 6707 973 4054 732 577 337 34.3
At last, this is the picture file world_population.png produced by the plotting script.
Gnuplot background image |