Reputation: 121
I am having some difficulties with multiplot. I am plotting wind directions and have a background image that is getting rescaled with the second (overlay) data plot. Here is my code :
set terminal png size 1000,750
set size 1,1
#ratio of canvas used (set with set terminal above)
set multiplot
set xrange [0:1000] ##size of png terminal 1000,750
set yrange [0:750]
# background picture's size is 1000x750 pixels,
# use xrange and yrange of these values
set grid
#unset tics
#unset border
#set lmargin at screen 0.175
#set rmargin at screen 0.9
set bmargin at screen 0.2
#set tmargin at screen 0.9
#Plot the background image
plot "plot_backgrnd2.png" binary filetype=png w rgbimage notitle
#Plot the wind data on top of the background image
set terminal png size 1000,750
set output "winddir.png"
#set style line 1 lw 2 lc rgb "red"
set style line 2 lw 2 lc rgb "blue"
#set style line 4 lw 1 lc rgb "sea-green"
set style increment user
# out draws the tic marks on the outside of the border; otherwise they'd be
# obscured by the boxes.
#set xtics rotate by 90 offset 0,-4 out nomirror
set bmargin at screen 0.2
set xtics rotate by 90 right
set xdata time
set yrange [0:360]
set ytics 45
set y2range [0:360]
set y2tics 45
set ylabel "Wind direction (Degrees from true N)"
set y2label rotate by -90
set y2label "Wind direction (Degrees from true N)"
set title "Average Wind Direction"
plot FILE using 1:12 title 'Average Wind Direction' with points pointtype 7 pointsize 1
unset multiplot
How do I prevent the background image from being rescaled when I change the yrange from [0:750] to [0:360]?
Any help would be appreciated, thanks in advance.
Upvotes: 0
Views: 993
Reputation: 48390
There are some strange things in your script:
You set your output file only after you plotted your background image, which is wrong.
According to your comment you want the background image to cover the whole image, and not only the plot area, is this correct or not?
I assume, that the background image should cover only the plot area.
I guess the problem you're having is related to the automatic margin computation. When plotting the background image you have no labels and different tic lengths, so that the automatically calculated margins for the first plot are different from those of the second plot.
You must set fixed values, like you did for the bmargin
, for all four margins. The following script should work (I cannot test it, because I have no test data):
set terminal png size 1000,750
set output "winddir.png"
set multiplot
set autoscale xfix
set autoscale yfix
unset tics
unset border
set lmargin at screen 0.175
set rmargin at screen 0.9
set bmargin at screen 0.2
set tmargin at screen 0.9
plot "plot_backgrnd2.png" binary filetype=png w rgbimage notitle
set xtics rotate by 90 right
set xdata time
set yrange [0:360]
set ytics 45
set y2range [0:360]
set y2tics 45
set ylabel "Wind direction (Degrees from true N)"
set y2label rotate by -90
set y2label "Wind direction (Degrees from true N)"
set title "Average Wind Direction"
plot FILE using 1:12 title 'Average Wind Direction' with points pointtype 7 pointsize 1
unset multiplot
Upvotes: 1