In the past I was able to easily save any line plot with a transparent background simply by saving the plot as:
plot.save,'transparent_plot.png',/TRANSPARENT
Unfortunately, this does not seem to work anymore if used with the plot function with the POSITION keyword. The following lines of code do not produce an expected transparent .png .
;;;; GPCP2b is a 16,16,12 array
;;;; Lines below produce a 12 month annual rainfall time series for a 16x16 grid
;;;; in the Caribbean.
DIM=16.
SC=1/DIM
p = plot(GPCP2b[0,0,*],position=[0,0,SC,SC],$
yrange=[0,max(GPCP2b)], XSHOWTEXT=0,$
YSHOWTEXT=0, color='black',TRANSPARENCY=0)
for i = 0,15 do begin
for j =0,15 do begin
p1=plot(GPCP2b[i,j,*],position=[SC*i,SC*j,SC*(i+1),SC*(j+1)] $,/current,
yrange=[0,max(GPCP2b)], XSHOWTEXT=0, YSHOWTEXT=0, color='black')
endfor
endfor
p1.save,'C:\datasets\testTRANS.png',/TRANSPARENT
I have tried various combinations of using BACKGROUND_COLOR and BACKGROUND_TRANSPARENCY in the plot commands, but nothing works.
This produces a transparent plot:
p = plot(GPCP2b[0,0,*],yrange=[0,max(GPCP2b)], XSHOWTEXT=0, YSHOWTEXT=0, $ color='black')
p.save,'C:\datasets\testTRANS.png',/TRANSPARENT
However, this DOES NOT:
p = plot(GPCP2b[0,0,*],position=[0,0,SC,SC],yrange=[0,max(GPCP2b )],$ XSHOWTEXT=0,YSHOWTEXT=0,color='black')
p.save,'C:\datasets\testTRANS.png',/TRANSPARENT
Any tips would be greatly appreciated. Thank you.
teddy
|