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

Home » Public Forums » archive » Re: Overplot contour on previously stablished coordinates
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 contour on previously stablished coordinates [message #83415 is a reply to message #83414] Fri, 01 March 2013 12:04 Go to previous messageGo to previous message
David Fanning is currently offline  David Fanning
Messages: 11724
Registered: August 2001
Senior Member
mairan.teodoro@gmail.com writes:

> This is the part of the code that does the plot:
>
> cgplot, findgen(100),title=strtrim(string(((w[i+j]-lref)/lref)*a.c/1 d5,form='(I10)'),2),$
> xsty=1, ysty=1, charsize=0.8,$
> xrange=[reform(astro[0,0,0]),reform(astro[size[1]-1,size[2]- 1,0])],$
> yrange=[reform(astro[0,0,1]),reform(astro[size[1]-1,size[2]- 1,1])],$
> /nodata, position=p
>
> ;;; this is my iso-velocity image
> cgimage, bytscl(rot(img, 0, missing=0), min=mindisplay, max=maxdisplay), position=p, /overplot,$
> xrange=[reform(astro[0,0,0]),reform(astro[size[1]-1,size[2]- 1,0])],$
> yrange=[reform(astro[0,0,1]),reform(astro[size[1]-1,size[2]- 1,1])]
>
> ;;; normalized intensity colorbar
> cgColorBar, position=[p[2]+0.005, p[1], p[2]+0.02, p[3]],$
> /vertical, /right, charsize=0.8,$
> range=[mindisplay,maxdisplay]
>
> ;;; this is just to show the axis in white in my iso-image
> cgplot, findgen(100),$
> xsty=1, ysty=1, xtickformat='(A1)', ytickformat='(A1)', axiscolor=cgcolor('white'),$
> xrange=[reform(astro[0,0,0]),reform(astro[size[1]-1,size[2]- 1,0])],$
> yrange=[reform(astro[0,0,1]),reform(astro[size[1]-1,size[2]- 1,1])],$
> /nodata, /noerase, position=p, charsize=0.8
>
> ;;; this is the contour obtained from a FITS image
> ;;; with astrometric solution stored in header.
> ;;; The size and orientation are not the same as
> ;;; that of my iso-velocity image.
> cgcontour, rot(data_img, 0.), levels=[0.9,5,8],$
> color='white', background='black',$
> label=0, olevels=olevels, /onimage, /missing
>
> The result for one image can be seen in this link:
>
> https://dl.dropbox.com/u/6573328/teodoro.png

OK, well, a couple of things. You are contaminating your color table
because you are working in indexed color. You see this by the white line
in your color bar. I would fix this by doing all your graphics in
decomposed color. (The other alternative would be to load your color
tables again just before you draw the color bar.) But, I would bracket
your graphics commands with this code, then you don't have to worry
about contaminating anything:

SetDecomposedState, 1, Current=currentState
graphics commands here...
SetDecomposedState, currentState

I can't tell why your contour plot is rotated, but I note that the data
you display as an image and the data you are contouring are not the same
data set. Are they suppose to be?

I also note that your contour plot isn't specifying the X and Y location
of the values you are trying to contour. This is probably the main
reason you are having problems. You are not telling IDL where the
contours are suppose to go! In other words, you are calling the contour
plot like this:

cgContour, data, /overplot

And you should be calling it like this:

cgContour, data, x, y, /overplot

The X and Y vectors are absolutely REQUIRED if you are overplotting.
Otherwise, there is no information to do the overplotting. If you don't
have these vectors, you can make them like this:

s = Size(rot(data_img, 0.), /Dimensions)
x = Scale_Vector(Findgen(s[0]), reform(astro[0,0,0]), $
reform(astro[size[1]-1,size[2]-1,0]))
y = Scale_Vector(Findgen(s[1]), reform(astro[0,0,1]),$
reform(astro[size[1]-1,size[2]-1,1]))

Cheers,

David
--
David Fanning, Ph.D.
Fanning Software Consulting, Inc.
Coyote's Guide to IDL Programming: http://www.idlcoyote.com/
Sepore ma de ni thue. ("Perhaps thou speakest truth.")
[Message index]
 
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: Undocumented functions in IDL
Next Topic: JD Smith Missing

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

Current Time: Thu Oct 09 21:47:42 PDT 2025

Total time taken to generate the page: 0.16115 seconds