Quality of Gnuplot’s SVG output

  Kiến thức lập trình

My intention is to generate a graph on my web page that shows when it’s dark and when it’s light. The graph shows the time on the vertical axis and the days from the beginning of January to the end of December on the horizontal axis.

The graph also shows when there is a new moon and a full moon.

But the resulting SVG file has 2 problems. 1) Extra white vertical line next to the right vertical axis. 2) Lots of empty g-tags.

My plotting script:

set terminal svg size 1000,500 noenhanced
set output "dose.svg"
set xlabel "Päiväys" textcolor rgb "white"
set label 1 'Clock value' at graph -0.08, graph 0.3 rotate
set xdata time
set locale "fi_FI.utf8"
set timefmt "%m-%d"
set xtics out
set format x "%b"
set ytics "0",3600,"86400" out
set title "Pimeysdiagrammi LL" font "arial, 20"
set key off
datafile="./f.data"
set datafile missing NaN
set yrange ["0":"86399"]
set ytics ("" 0)
do for [y = 0:23] {
   set ytics add (sprintf("%d",y) (y*3600))
}
set grid ytics lt 2 lc rgb "red" lw 1

set border lw 2 lc rgb "orange"

set xtics textcolor rgb "white"
set ytics textcolor rgb "white"

set ylabel "Kello" textcolor rgb "white"

set title textcolor rgb "white"

set object 1 rectangle from graph 0, graph 0 to graph 1, graph 1 behind fc rgbcolor 'white' fs noborder
plot datafile using 1:2 w filledcurve x1 lc rgb "#BFD0FB", 
 '' using 1:3 w filledcurve x2 lc rgb "#BFD0FB", 
 '' using 1:4 w filledcurve x1 lc rgb "#7FA2F7", 
 '' using 1:5 w filledcurve x2 lc rgb "#7FA2F7", 
 '' using 1:6 w filledcurve x1 lc rgb "#3F74F3", 
 '' using 1:7 w filledcurve x2 lc rgb "#3F74F3", 
 '' using 1:8 w filledcurve x1 lc rgb "#0046F0", 
 '' using 1:9 w filledcurve x2 lc rgb "#0046F0", 
 '' using 1:10 w filledcurve x1 lc rgb "#002EA0", 
 '' using 1:11 w filledcurve x2 lc rgb "#002EA0", 
 '' using 1:12 w filledcurve x1 lc rgb "#001750", 
 '' using 1:13 w filledcurve x2 lc rgb "#001750", 
 '' using 1:14 w filledcurve x1 lc rgb "black", 
 '' using 1:15 w filledcurve x2 lc rgb "black", 
 '' using 1:16 w impulse lc rgb "green", 
 '' u 1:17:((strcol(18) eq "New") ? ('UUSI'):NaN) w labels left font "Symbola,14" offset -0.5,0, 
 '' u 1:17:((strcol(18) eq "Full") ? ('VANHA'):NaN) w labels left font "Symbola,14" offset -0.5,0

Example line of data:

1-25 33780 54120 33540 54300 33240 54600 33060 54840 29160 58680 25380 62520 21840 66000 0 71640 Full

Resulting image (Please note that this image has white elements on transparent areae. Please note that some text content is altered/added in post-proressing phase)
https://ig.fi/sci/aurinko.svg?65,25

A nice graph without extra lines or tags.

LEAVE A COMMENT