The position of plotted data points is different if I use a background image or not, let me explain:
If I generate a chart (One.png) using this script without a background image:
$DATA<<EOD
1.0000,"2.0 Years\n10.0",277.5000,249.1100
2.0000,"3.0 Years\n11.0",345.4167,312.1800
3.0000,"4.0 Years\n12.0",413.3333,375.2500
4.0000,"5.0 Years\n13.0",481.2500,438.3200
5.0000,"6.0 Years\n14.0",549.1667,501.3900
6.0000,"7.0 Years\n15.0",617.0833,564.4600
7.0000,"8.0 Years\n16.0",685.0000,627.5300
8.0000,"9.0 Years\n17.0",752.9167,690.6000
9.0000,"10.0 Years\n18.0",820.8333,753.6700
10.0000,"11.0 Years\n19.0",888.7500,816.7400
11.0000,"12.0 Years\n20.0",956.6667,879.8100
12.0000,"13.0 Years\n21.0",1024.5833,942.8800
13.0000,"14.0 Years\n22.0",1092.5000,1005.9500
14.0000,"15.0 Years\n23.0",1160.4167,1069.0200
15.0000,"16.0 Years\n33.0",1228.3333,1699.7200
16.0000,"17.0 Years\n34.0",1296.2500,1762.7900
17.0000,"18.0 Years\n35.0",1364.1667,1825.8600
18.0000,"19.0 Years\n36.0",1432.0833,1888.9300
19.0000,"20.0 Years\n37.0",1500.0000,1952.0000
EOD
set datafile separator comma
set style data point
set terminal pngcairo enhanced size 1700,2200
set output 'C:\temp\One.png'
unset xtics; unset ytics; unset x2tics; unset y2tics
set grid noxtics
set grid noytics
set border 0
set colorsequence classic
set key off
set xrange [0:1699]
set yrange [0:2199]
set label 01 "This is the name" at 1136.00,2050.00 font "Tahoma,20" left front textcolor rgb "black"
set label 02 "Record No." at 1409.90,2007.00 font "Tahoma,20" left front textcolor rgb "black"
plot $DATA using ($3):($4) with points pt 1 ps 4 lc rgb "0xE25822" lw 3 notitle
The resulting chart looks great:
Now, If I use One.png as my background image and generate a chart with the same script\data points:
$DATA<<EOD
1.0000,"2.0 Years\n10.0",277.5000,249.1100
2.0000,"3.0 Years\n11.0",345.4167,312.1800
3.0000,"4.0 Years\n12.0",413.3333,375.2500
4.0000,"5.0 Years\n13.0",481.2500,438.3200
5.0000,"6.0 Years\n14.0",549.1667,501.3900
6.0000,"7.0 Years\n15.0",617.0833,564.4600
7.0000,"8.0 Years\n16.0",685.0000,627.5300
8.0000,"9.0 Years\n17.0",752.9167,690.6000
9.0000,"10.0 Years\n18.0",820.8333,753.6700
10.0000,"11.0 Years\n19.0",888.7500,816.7400
11.0000,"12.0 Years\n20.0",956.6667,879.8100
12.0000,"13.0 Years\n21.0",1024.5833,942.8800
13.0000,"14.0 Years\n22.0",1092.5000,1005.9500
14.0000,"15.0 Years\n23.0",1160.4167,1069.0200
15.0000,"16.0 Years\n33.0",1228.3333,1699.7200
16.0000,"17.0 Years\n34.0",1296.2500,1762.7900
17.0000,"18.0 Years\n35.0",1364.1667,1825.8600
18.0000,"19.0 Years\n36.0",1432.0833,1888.9300
19.0000,"20.0 Years\n37.0",1500.0000,1952.0000
EOD
set datafile separator comma
set style data point
set terminal pngcairo enhanced size 1700,2200
set output 'C:\temp\Two.png'
unset xtics; unset ytics; unset x2tics; unset y2tics
set grid noxtics
set grid noytics
set border 0
set colorsequence classic
set key off
set xrange [0:1699]
set yrange [0:2199]
set label 01 "This is the name" at 1136.00,2050.00 font "Tahoma,20" left front textcolor rgb "black"
set label 02 "Record No." at 1409.90,2007.00 font "Tahoma,20" left front textcolor rgb "black"
plot 'C:\temp\One.png' binary filetype=PNG w rgbimage,\
$DATA using ($3):($4) with points pt 1 ps 4 lc rgb "0xE25822" lw 3 notitle
The resulting Two.png image shows the data points not in the same place as One.png, they are being "pulled" towards the center of the image:
Why having a background image (or not) affects the position of the data points? and how can this be prevented?
Thank you, Roberto
According to the StackOverflow rule: "no answers in comments", let me put this into an answer:
Set your margins to zero:
set margins 0,0,0,0
This works fine if you don't need margins and axes labels. However, I still don't fully understand your final goal. Why are you not using set multiplot
to overlay two plots?
However, if you want put a given background image into a graph (without using multiplot
), but with axes labels and defined coordinates, I haven't found yet a satisfying solution. Maybe I will post it as question.