Reputation: 2657
I'm using the plot 'my_image.png' binary filetype=png with rgbimage
feature of gnuplot to superimpose images on a (scarce) scatterplot.
My png's have a transparent background, so I had been hoping that they could 'respect' the grid and axes, but unfortunately they are plotted on top of it with a white, opaque background.
Is there any ways to address this issue ?
The file 2091450.png is provided by First Google result for Transparent PNG :
set terminal pdfcairo font "CMU Serif" linewidth 4 rounded \
fontscale 1.0 size 29.7cm, 21cm enhanced dashed
set output 'transparency_test.pdf'
set style line 81 lt rgb "#808080"
set style line 80 lt 0 # dashed
set style line 80 lt rgb "#808080" # grey
set grid back linestyle 80
set border 3 back linestyle 81
plot '2091450.png' binary filetype=png origin=(0,0) dx=1.0 dy=1.0 with rgbimage
Upvotes: 4
Views: 2247
Reputation: 48390
Several things:
Your links gives me only a jpg image despite the URL name (If it would be transparent, you would get only a completely black image as result with the rgbimage
style).
To plot images with transparency use the rgbalpha
plotting style:
plot 'transparencytest.png' binary filetype=png with rgbalpha
I used the following file transparencytest.png
for testing, which works fine:
Why don't you just put the grid and the border to the front
layer?
Upvotes: 3
Reputation: 2657
This is a classic case of an answer I couldn't solve initially because of an inappropriate Google search : looking for 'gnuplot png image transparency' was not productive at all, because all the keywords interacts with each others to yield different results.
But a search for 'rgbimage transparency' was much better because of reduced interference between words and led me to this page with the appropriate result :
Instead of using rgbimage
, simply use rgbalpha
.
Upvotes: 1