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

Home » Public Forums » archive » Make the plots invisible
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
Make the plots invisible [message #82045] Sun, 11 November 2012 01:53 Go to next message
d.poreh is currently offline  d.poreh
Messages: 406
Registered: October 2007
Senior Member
Folks,
Hi,
I want to make some plots and make the plots invisible, that means just i want to save the plots like this:

p = plot(x(*,i),color='blue',thick=2)

p.save, 'plot1.jpg'
but without a window pops up,
Cheers,
Dave
Re: Make the plots invisible [message #82079 is a reply to message #82045] Thu, 15 November 2012 08:11 Go to previous message
David Fanning is currently offline  David Fanning
Messages: 11724
Registered: August 2001
Senior Member
David Fanning writes:

> OK, close. I think this is nearly what we want, except
> for those extraneous labels.

Alright. After all is said and done, the function graphics
output, if not the programming time, *is* getting faster.

I've updated the original article:

http://www.idlcoyote.com/cg_tips/compcont.php

Cheers,

David



--
David Fanning, Ph.D.
Fanning Software Consulting, Inc.
Coyote's Guide to IDL Programming: http://www.dfanning.com/
Sepore ma de ni thue. ("Perhaps thou speakest truth.")
Re: Make the plots invisible [message #82082 is a reply to message #82045] Thu, 15 November 2012 06:43 Go to previous message
David Fanning is currently offline  David Fanning
Messages: 11724
Registered: August 2001
Senior Member
Alain writes:

> You should have read more carefully and executed the code
> I sent previously. It is pretty close of what you want.
> A slightly modified version follows:

OK, close. I think this is nearly what we want, except
for those extraneous labels. Here is a picture of
the final output:

http://www.idlcoyote.com/misc/fg_map_final.png

> The trick is to draw the map first, then to overplot the
> filled and line contours.

Yes, I would have probably discovered this trick for
myself, had I spent another 8-10 hours on the problem!
I certainly wouldn't have discovered it in the
documentation.

Thanks for your help!

David

;****************************************************
PRO FG_Map_Contour

restore, 'air.nc.data.sav'
nlevels = 12
xrange = [Min(lon), Max(lon)]
yrange = [Min(lat), Max(lat)]
center_lon = (xrange[1]-xrange[0])/2.0 + xrange[0]
nlevels = 12
levels = cgConLevels(Float(data), NLevels=nlevels+1, $
MinValue=Floor(Min(data)), STEP=step, Factor=1)
mylat = 40.6 ; Latitude of Fort Collins, Colorado.
mylon = 254.9 ; Longitude of Fort Collins, Colorado.

cgLoadCT, 2, /Reverse, /Brewer, NColors=nlevels, RGB_Table=rgb
rgb[11,*] = [255, 255, 255]

win = WINDOW(WINDOW_TITLE = 'Function Graphics', $
dimensions = [700, 600])

win.Refresh, /Disable

mp = map('Equirectangular', CENTER_LONGITUDE=180, $
POSITION=[0.1,0.1,0.90,0.80], $
LABEL_POSITION = 0, BOX_AXES=1, $
GRID_LATITUDE = 30, GRID_LONGITUDE = 45, $
/CURRENT, ASPECT_RATIO=0)
mp['Longitudes'].LABEL_ANGLE = 90

cn = contour(data, lon, lat, /OVERPLOT, $
GRID_UNITS=2, MAP_PROJECTION='Equirectangular', $
RGB_TABLE=rgb, /CURRENT, RGB_INDICES=Indgen(nlevels), $
C_VALUE=levels, /FILL)

cn1 = contour(data, lon, lat, /OVERPLOT, $
GRID_UNITS=2, MAP_PROJECTION='Equirectangular', $
RGB_TABLE=rgb, /CURRENT, $
C_VALUE=levels, C_COLOR=!Color.White)

c = MapContinents(Color=cgColor('tomato', /Triple, /Row))

cb = Colorbar(Tickname=levels, RGB_TABLE=rgb, Range=[Min(levels), $
Max(levels)], $
Major=11, /Border_On, Title='Temperature $\deg$K', $
Position=[0.1, 0.88, 0.9, 0.93], Minor=0, TAPER=3)

s = Symbol(mylon, mylat, /Data, /Current, 'Star', $
/Sym_Filled, Sym_Color='red')

win.Refresh
END
;****************************************************

--
David Fanning, Ph.D.
Fanning Software Consulting, Inc.
Coyote's Guide to IDL Programming: http://www.dfanning.com/
Sepore ma de ni thue. ("Perhaps thou speakest truth.")
Re: Make the plots invisible [message #82083 is a reply to message #82045] Thu, 15 November 2012 06:22 Go to previous message
lecacheux.alain is currently offline  lecacheux.alain
Messages: 325
Registered: January 2008
Senior Member
Le jeudi 15 novembre 2012 14:44:52 UTC+1, David Fanning a écrit :
> Alain writes:
>
>
>
>> Ten minutes with your example gave me the following:
>
>
>
> Ah. I would have thought the word "duplicate" came
>
> from the French, but apparently not. ;-)
>
>
>
> OK, I have completely given up on getting an exact
>
> duplication of the plot I want, but it has to be
>
> considerably closer than this example!
>
>
>
> Robert Vincent and I spent another couple of hours
>
> working on this together last night. Although Robert
>
> had decided to give up on function graphics by the end
>
> of the night, I'm dumb enough to keep plodding onward.
>
>
>
> Anyway, together we came up with something that was
>
> showing some promise. Here is a comparison between
>
> the plot we are trying to duplicate on the left,
>
> and the plot we have come up with on the right:
>
>
>
> http://www.idlcoyote.com/misc/fg_map_side_by_side.png
>
>
>
> It took nearly forever to figure out the color bar,
>
> but we finally got it.
>
>
>
> There are obvious problems. The FG contour plot is
>
> still VERY small in the window. We haven't been able
>
> to figure out how to make it bigger. It seems to
>
> ignore the POSITION keyword we are passing to it.
>
> The box axes are a total joke. You can only label
>
> them on two sides, and even then, you can't label
>
> them as normal box axes.
>
>
>
> But, still, it was looking pretty good. At least
>
> it was until I took a close look at the lines that
>
> we overplot onto the filled contours. You have to
>
> blow up the plot to see this really well, so here
>
> is a blow up of the FG contour plot:
>
>
>
> http://www.idlcoyote.com/misc/fg_map_blowup.png
>
>
>
> You will notice that the overplotted lines don't
>
> line up AT ALL with the filled contours!!!!
>
>
>
> This, despite the fact that the two contour commands
>
> we use to create the filled and outline contours are
>
> IDENTICAL as far as we can tell!
>
>
>
> Here is the code we are currently using:
>
>
>
> http://www.idlcoyote.com/misc/fg_map_contour.pro
>
>
>
> We welcome any and all to tell us what we are doing
>
> wrong.
>
>
>
> Cheers,
>
>
>
> David
>
> --
>
> David Fanning, Ph.D.
>
> Fanning Software Consulting, Inc.
>
> Coyote's Guide to IDL Programming: http://www.dfanning.com/
>
> Sepore ma de ni thue. ("Perhaps thou speakest truth.")

You should have read more carefully and executed the code I sent previously. It is pretty close of what you want. The trick is to draw the map first, then to overplot the filled and line contours. A slightly modified version follows:

;-----------------------------------------
restore, 'air.nc.data.sav'
t = systime(1)

Loadct, 53, RGB_TABLE=rgb
rgb = reverse(rgb,1)

nlevels = 12
levels = round((max(data, MIN=mindata) - floor(mindata))*findgen(nlevels)/nlevels) + floor(mindata)
levels = [levels[0], levels]

win = Window(Dimension=[640, 512])
win.Refresh, /DISABLE

mp = map('Equirectangular', CENTER_LONGITUDE=180, $
POSITION=[0.1,0.05,0.95,0.80], $
LABEL_POSITION = 0, BOX_AXES=1, $
GRID_LATITUDE = 30, GRID_LONGITUDE = 45, $
/CURRENT, ASPECT_RATIO=0)
mp['Longitudes'].LABEL_ANGLE = 90

cn = contour(data, lon, lat, /OVERPLOT, $
GRID_UNITS=2, MAP_PROJECTION='Equirectangular', $
RGB_TABLE=rgb, /CURRENT, $
C_VALUE=levels, /FILL)

cn1 = contour(data, lon, lat, /OVERPLOT, $
GRID_UNITS=2, MAP_PROJECTION='Equirectangular', $
RGB_TABLE=rgb, /CURRENT, $
C_VALUE=levels, C_COLOR=!Color.White)

cb = COLORBAR(POSITION=[0.1, 0.91, 0.95, 0.95], $
BORDER=1, TARGET=cn, TICKVALUES=levels, TITLE='Temperature °K')

m = MapContinents(COLOR=!Color.red)

win.Refresh

print,'elaps:', systime(1) - t

end
;----------------------------------------------

There is no particular difficulty nor surprise, except the '0°E' extra label.

alain.
Re: Make the plots invisible [message #82084 is a reply to message #82045] Thu, 15 November 2012 05:44 Go to previous message
David Fanning is currently offline  David Fanning
Messages: 11724
Registered: August 2001
Senior Member
Alain writes:

> Ten minutes with your example gave me the following:

Ah. I would have thought the word "duplicate" came
from the French, but apparently not. ;-)

OK, I have completely given up on getting an exact
duplication of the plot I want, but it has to be
considerably closer than this example!

Robert Vincent and I spent another couple of hours
working on this together last night. Although Robert
had decided to give up on function graphics by the end
of the night, I'm dumb enough to keep plodding onward.

Anyway, together we came up with something that was
showing some promise. Here is a comparison between
the plot we are trying to duplicate on the left,
and the plot we have come up with on the right:

http://www.idlcoyote.com/misc/fg_map_side_by_side.png

It took nearly forever to figure out the color bar,
but we finally got it.

There are obvious problems. The FG contour plot is
still VERY small in the window. We haven't been able
to figure out how to make it bigger. It seems to
ignore the POSITION keyword we are passing to it.
The box axes are a total joke. You can only label
them on two sides, and even then, you can't label
them as normal box axes.

But, still, it was looking pretty good. At least
it was until I took a close look at the lines that
we overplot onto the filled contours. You have to
blow up the plot to see this really well, so here
is a blow up of the FG contour plot:

http://www.idlcoyote.com/misc/fg_map_blowup.png

You will notice that the overplotted lines don't
line up AT ALL with the filled contours!!!!

This, despite the fact that the two contour commands
we use to create the filled and outline contours are
IDENTICAL as far as we can tell!

Here is the code we are currently using:

http://www.idlcoyote.com/misc/fg_map_contour.pro

We welcome any and all to tell us what we are doing
wrong.

Cheers,

David
--
David Fanning, Ph.D.
Fanning Software Consulting, Inc.
Coyote's Guide to IDL Programming: http://www.dfanning.com/
Sepore ma de ni thue. ("Perhaps thou speakest truth.")
Re: Make the plots invisible [message #82086 is a reply to message #82045] Thu, 15 November 2012 04:36 Go to previous message
lecacheux.alain is currently offline  lecacheux.alain
Messages: 325
Registered: January 2008
Senior Member
Le mercredi 14 novembre 2012 18:30:25 UTC+1, David Fanning a écrit :
> David Fanning writes:
>
>
>
>> Seriously? No help whatsoever!?
>
>
>
> By the way, the article only seeks to record the
>
> time it takes to render the graphics result, not
>
> the time it takes to write the code! This is a
>
> learning experience, after all. :-)
>
>
>
> http://www.idlcoyote.com/cg_tips/compcont.php
>
>
>
> Cheers,
>
>
>
> David
>
>
>
> --
>
> David Fanning, Ph.D.
>
> Fanning Software Consulting, Inc.
>
> Coyote's Guide to IDL Programming: http://www.dfanning.com/
>
> Sepore ma de ni thue. ("Perhaps thou speakest truth.")

Hi David,
Ten minutes with your example gave me the following:

;-----------------------------------
restore, 'air.nc.data.sav'
t = systime(1)

Loadct, 53, RGB_TABLE=rgb
rgb = reverse(rgb,1)

nlevels = 12
levels = round((max(data, MIN=mindata) - floor(mindata))*findgen(nlevels)/nlevels) + floor(mindata)
levels = [levels[0], levels]

win = Window(Dimension=[640, 512])
win.Refresh, /DISABLE

mp = map('Equirectangular', CENTER_LONGITUDE=180, $
POSITION=[0.1,0.05,0.95,0.80], $
LABEL_POSITION = 0, BOX_AXES=1, $
GRID_LATITUDE = 30, GRID_LONGITUDE = 45, $
/CURRENT)
mp['Longitudes'].LABEL_ANGLE = 90

cn = contour(data, lon, lat, /OVERPLOT, $
GRID_UNITS=2, MAP_PROJECTION='Equirectangular', $
RGB_TABLE=rgb, /CURRENT, $
C_VALUE=levels, /FILL)

cb = COLORBAR(POSITION=[0.1, 0.91, 0.95, 0.95], $
BORDER=1, TARGET=cn, TICKVALUES=levels)

m = MapContinents(COLOR=!Color.red)

win.Refresh

print,'elaps:', systime(1) - t

end
;------------------------------------------

looking to solve most of the issues you pointed out.
I do not understand the '0°E' appearing twice along X-axis. A NG bug ? Who knows ?

alain.
Re: Make the plots invisible [message #82091 is a reply to message #82045] Wed, 14 November 2012 09:30 Go to previous message
David Fanning is currently offline  David Fanning
Messages: 11724
Registered: August 2001
Senior Member
David Fanning writes:

> Seriously? No help whatsoever!?

By the way, the article only seeks to record the
time it takes to render the graphics result, not
the time it takes to write the code! This is a
learning experience, after all. :-)

http://www.idlcoyote.com/cg_tips/compcont.php

Cheers,

David

--
David Fanning, Ph.D.
Fanning Software Consulting, Inc.
Coyote's Guide to IDL Programming: http://www.dfanning.com/
Sepore ma de ni thue. ("Perhaps thou speakest truth.")
  Switch to threaded view of this topic Create a new topic Submit Reply
Previous Topic: Re: Function Graphics Take Home Message
Next Topic: Re: Quick question... OS Version

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

Current Time: Wed Oct 08 15:36:21 PDT 2025

Total time taken to generate the page: 0.00778 seconds