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

Home » Public Forums » archive » Re: Overplot behalfs strange
Show: Today's Messages :: Show Polls :: Message Navigator
E-mail to friend 
Return to the default flat view Create a new topic Submit Reply
Re: Overplot behalfs strange [message #73304 is a reply to message #73265] Wed, 03 November 2010 09:51 Go to previous messageGo to previous message
David Fanning is currently offline  David Fanning
Messages: 11724
Registered: August 2001
Senior Member
sirvival writes:

> I am trying to plot an array and then do an overplot with a contour of
> the same data.
>
>
> My code is like this
>
> colors
> y = indgen((ey-5)-(sy+5)+1)+(sy+5)
> window,5,xsize=1280,ysize=1000
> loadct,0
> display,ordim[sx:ex,sy+5:ey-5],x,y,/log,xtitle='Pixel',ytitl e='Pixel'
> colors
> contour,ordim[sx:ex,sy+5:ey-5],x,y,nlevels=15,thick=2.5,col= 2,/
> overplot
>
>
> This does not work like I want it too. The contour does not get ploted
> as it seems.
>
> But if I do another plot in advance that looks the same but uses the /
> noerase keyword with contour I get what I am looking for.
> e.g.
> window,0
> display,ordim
> contour,ordim,nlevels=20,/noerase
>
> If I close idl it gets "reseted" and I have to do the /noerase plot
> again to get my plot working.
>
> Its not an big issue but I wonder whats happening.
>
> What I want is:
> http://img841.imageshack.us/img841/9059/contour.jpg

Ah, yes, timely question. I am working on this section
of my book now. You are going to like it. :-)

The problem you have is that "Display" is probably
just displaying an image, not setting up a data
coordinate space. Hence, there is nothing for Contour
to "overplot" on. No data coordinate space!!

With images, it is typically necessary (because
image don't create data coordinate spaces in IDL),
to "draw" a data coordinate space over the top of them.
We try to do this invisibly, of course, so we usually
turn the axes completely off. Your commands should be
something like this:

contour,ordim[sx:ex,sy+5:ey-5],x,y,nlevels=15,thick=2.5,$
col=2, xstyle=5, ystyle=5, /nodata
display,ordim[sx:ex,sy+5:ey-5],x,y,/log,xtitle='Pixel',$
ytitle='Pixel'
contour,ordim[sx:ex,sy+5:ey-5],x,y,nlevels=15,thick=2.5,$
col=2,/overplot

Or, you could just continue to use that NOERASE keyword.
That's what I would probably do. You just need to remember
to erase your display window before you display your image,
since I doubt Display remembers to do that for you either.

By the way, you are doing your contour plots all wrong, too. :-)

http://www.dfanning.com/documents/tips.html#CONTOURPLOTTIPS

Cheers,

David


--
David Fanning, Ph.D.
Fanning Software Consulting, Inc.
Coyote's Guide to IDL Programming: http://www.dfanning.com/
Sepore ma de ni thui. ("Perhaps thou speakest truth.")
[Message index]
 
Read Message
Read Message
Read Message
Read Message
Previous Topic: Re: paging question
Next Topic: N-body integrator

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

Current Time: Sun Oct 12 14:23:19 PDT 2025

Total time taken to generate the page: 0.16297 seconds