comp.lang.idl-pvwave archive
Messages from Usenet group comp.lang.idl-pvwave, compiled by Paulo Penteado

Home » Public Forums » archive » Re: transparent background for line plot in IDL 8.0
Show: Today's Messages :: Show Polls :: Message Navigator
E-mail to friend 
Switch to threaded view of this topic Create a new topic Submit Reply
Re: transparent background for line plot in IDL 8.0 [message #72412] Wed, 15 September 2010 15:15 Go to next message
chris_torrence@NOSPAM is currently offline  chris_torrence@NOSPAM
Messages: 528
Registered: March 2007
Senior Member
On Sep 15, 7:23 am, teddyallen <teddyal...@yahoo.com> wrote:
> I have a question that seems to be simple, but the answer continues to
> elude me....
> I have a straight-forward 2D plot (rainfall time series) that I want
> to import to powerpoint, BUT I would like to import it with a
> transparent background. Basically, I just want the plot with no
> background color. I have read the previous posts, but am lead to
> believe that 8.0 should be more simple.
>
> Below is my plot command:
>
> p=PLOT(leeTRMMday, color
> ='magenta',yrange=[0,0.5],thick=2,xticks=12,xtickname = months,$
>        title='1998 - 2009 TRMM daily climatology',
> background='transparent')
>
> Is the BACKGROUND keyword used properly? The plot is what I want, but
> the background is still white.There are no compilation errors. What
> exactly does the BACKGROUND keyword in the PLOT procedure represent?
> Is this not the correct way to reference a clear background for a
> plot?
>
> Thank you for any hints.
> cheers,
> teddy allen

Hi Teddy,

You should be able to export to a transparent PNG:

p=PLOT(leeTRMMday,
color='magenta',yrange=[0,0.5],thick=2,xticks=12,xtickname = months,$
title='1998 - 2009 TRMM daily climatology')
p.Save, 'myplot.png', /TRANSPARENT

There are other keywords to the Save method which might be useful,
like BORDER, RESOLUTION, WIDTH, HEIGHT, etc.

Cheers,
Chris
ITTVIS
Re: transparent background for line plot in IDL 8.0 [message #72414 is a reply to message #72412] Wed, 15 September 2010 13:48 Go to previous messageGo to next message
David Grier is currently offline  David Grier
Messages: 35
Registered: July 2010
Member
On 9/15/10 9:23 AM, teddyallen wrote:
> I have a question that seems to be simple, but the answer continues to
> elude me....
> I have a straight-forward 2D plot (rainfall time series) that I want
> to import to powerpoint, BUT I would like to import it with a
> transparent background. Basically, I just want the plot with no
> background color. I have read the previous posts, but am lead to
> believe that 8.0 should be more simple.
>
> Below is my plot command:
>
> p=PLOT(leeTRMMday, color
> ='magenta',yrange=[0,0.5],thick=2,xticks=12,xtickname = months,$
> title='1998 - 2009 TRMM daily climatology',
> background='transparent')
>
> Is the BACKGROUND keyword used properly? The plot is what I want, but
> the background is still white.There are no compilation errors. What
> exactly does the BACKGROUND keyword in the PLOT procedure represent?
> Is this not the correct way to reference a clear background for a
> plot?
>
> Thank you for any hints.
> cheers,
> teddy allen

From reading graphic__define.pro, which provides the basic object
definitions for the plot function, it appears that your request
to set BACKGROUND is actually setting the BACKGROUND_COLOR property.
This appears to be just an RGB triplet (or an index into a color table).
Consequently, "transparent" probably isn't valid, and is just ignored.
As far as I can tell, there isn't a one-shot way to get a transparent
background on new-style plot.

You might, however, export the plot in a format that allows for
transparency, and then use another tool to turn the background color
transparent. I use ImageMagick for this on linux and mac systems.

TTFN,

David
Re: transparent background for line plot in IDL 8.0 [message #94351 is a reply to message #72412] Mon, 17 April 2017 10:21 Go to previous message
lucanardi93 is currently offline  lucanardi93
Messages: 1
Registered: April 2017
Junior Member
Il giorno giovedì 16 settembre 2010 00:15:49 UTC+2, Chris Torrence ha scritto:
> On Sep 15, 7:23 am, teddyallen <teddyal...@yahoo.com> wrote:
>> I have a question that seems to be simple, but the answer continues to
>> elude me....
>> I have a straight-forward 2D plot (rainfall time series) that I want
>> to import to powerpoint, BUT I would like to import it with a
>> transparent background. Basically, I just want the plot with no
>> background color. I have read the previous posts, but am lead to
>> believe that 8.0 should be more simple.
>>
>> Below is my plot command:
>>
>> p=PLOT(leeTRMMday, color
>> ='magenta',yrange=[0,0.5],thick=2,xticks=12,xtickname = months,$
>>        title='1998 - 2009 TRMM daily climatology',
>> background='transparent')
>>
>> Is the BACKGROUND keyword used properly? The plot is what I want, but
>> the background is still white.There are no compilation errors. What
>> exactly does the BACKGROUND keyword in the PLOT procedure represent?
>> Is this not the correct way to reference a clear background for a
>> plot?
>>
>> Thank you for any hints.
>> cheers,
>> teddy allen
>
> Hi Teddy,
>
> You should be able to export to a transparent PNG:
>
> p=PLOT(leeTRMMday,
> color='magenta',yrange=[0,0.5],thick=2,xticks=12,xtickname = months,$
> title='1998 - 2009 TRMM daily climatology')
> p.Save, 'myplot.png', /TRANSPARENT
>
> There are other keywords to the Save method which might be useful,
> like BORDER, RESOLUTION, WIDTH, HEIGHT, etc.
>
> Cheers,
> Chris
> ITTVIS

Hi, this is a very old post. Anyway I have a similar problem, but this method doesn't work.
I have a series of data of longitude/latitude and a value associated with a value. I use map_set to plot them, but I work with an asteroid, so i cannot use IDL basic maps, but I need to plot the data on an image.
A wonderful solution would be to use the image as background for the map_set, but I think it's not possibile, so i have to have a transparent background for the data so that i can overimpose the image data to asteroid map.
My code is the following, thank you.
restore, 'variabilinirs.sav'
itokawa = 'desktop\itokawa_map_3600.jpg'
c1 = min(bar[*,2]) ;limiti superiori e inferiori di band area
c2 = max(bar[*,2])
varc = reform(bar[*,2]) ;rende bandareas un array di dim 2 (s ed l) alla lunghezza d'onda del centro banda, deve essere s,l anche questo!
kk = where(varc gt c1 and varc lt c2) ;prende indici varc entro i due limiti scelti di banddepth
aa = varc(kk) ;prende varc solo entro gli indici kk
device, decomposed=0 ;per colori
loadct, 39
map_set,/cylindrical
plots,longc(kk),latc(kk),color=255.*(aa-c1)/float(c2-c1),psy m=1
map_grid, label=0
;colorbar, minor=c1*100.,major=c2*100.,col=0,div=5, /vertical
a=tvrd(true=1) & write_png,'mappa.png',a
read_jpeg,itokawa,alb
read_png,'mappa.png',ker
r1=image(alb)
r2=image(ker,/overplot)
r2.save, "desktop"
r2.close
  Switch to threaded view of this topic Create a new topic Submit Reply
Previous Topic: LinkedList not recognized as object by Help
Next Topic: UNIT

-=] Back to Top [=-
[ Syndicate this forum (XML) ] [ RSS ] [ PDF ]

Current Time: Wed Oct 08 07:23:04 PDT 2025

Total time taken to generate the page: 0.46730 seconds