comp.lang.idl-pvwave archive - RDF feed
type: channel
description: Messages from Usenet group comp.lang.idl-pvwave, compiled by Paulo Penteado
items: Re: Overlaying a contour on a small image

Re: Overlaying a contour on a small image
type: item
description: Wayne Landsman writes: > Does anyone have a routine to overlay a contour plot on a small image > that is both accurate and aesthetically pleasing? Isn't this what you want: im = dist(9) thispostion = [0.1, 0.1, 0.9, 0.9] TVIMAGE, bytscl(im), POSITION=thisPosition, /KEEP_ASPECT_RATIO, $ /NOINTERP, /ERASE contour,im, Position=thisPosition,/xsty,/ysty,/noerase,$ scale_vector(findgen(9), 0, 9), scale_vector(findgen(9), 0, 9) You can find SCALE_VECTOR here: http://www.dfanning.com/programs/scale_vector.pro 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.")
creator: David Fanning
date: 2008-02-29T18:41:14-00:00

Re: Overlaying a contour on a small image
type: item
description: David Fanning writes: > Wayne Landsman writes: > >> Does anyone have a routine to overlay a contour plot on a small image >> that is both accurate and aesthetically pleasing? > > Isn't this what you want: > > im = dist(9) > thispostion = [0.1, 0.1, 0.9, 0.9] > TVIMAGE, bytscl(im), POSITION=thisPosition, /KEEP_ASPECT_RATIO, $ > /NOINTERP, /ERASE > contour,im, Position=thisPosition,/xsty,/ysty,/noerase,$ > scale_vector(findgen(9), 0, 9), scale_vector(findgen(9), 0, 9) I don't know. What do you think of this: im = dist(9) im[2,2] = 15 im[4:5, 4:5] = 10 thispostion = [0.1, 0.1, 0.9, 0.9] TVIMAGE, bytscl(im), POSITION=thisPosition, /KEEP_ASPECT_RATIO, $ /NOINTERP, /ERASE contour,im, Position=thisPosition,/xsty,/ysty,/noerase,$ scale_vector(findgen(9), 0, 9), scale_vector(findgen(9), 0,9), $ level = 6 isocontour, im, v, c, c_value = 6 Plots, v[0,0:6]+0.5, v[1,0:6]+0.5, color=fsc_color('dodger blue') Plots, v[0,7:*]+0.5, v[1,7:*]+0.5, color=fsc_color('dodger blue') Note how I have to add a half pixel to the ISOCONTOUR to get it anywhere near where I want it. Weird. 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.")
creator: David Fanning
date: 2008-02-29T19:06:51-00:00

Re: Overlaying a contour on a small image
type: item
description: Just trying it out, using pg_plotimage http://hea-www.harvard.edu/~pgrigis/idl_stuff/pg_plotimage.p ro ;linear test array, easier to deal with than dist a=[[0.,1,2,1,0],[1,2,3,2,1],[2,3,4,3,2],[1,2,3,2,1],[0,1,2,1 ,0]] loadct,5 pg_plotimage,a,findgen(5),findgen(5) contour,a,/over,levels=[0.5,1.5,2.5,3.5],color=0 (The contours should have a vertex exactly at the pixel boundaries by construction of the image) The half pixel at the boundary is missing however. Paolo David Fanning wrote: > David Fanning writes: > >> Wayne Landsman writes: >> >>> Does anyone have a routine to overlay a contour plot on a small image >>> that is both accurate and aesthetically pleasing? >> >> Isn't this what you want: >> >> im = dist(9) >> thispostion = [0.1, 0.1, 0.9, 0.9] >> TVIMAGE, bytscl(im), POSITION=thisPosition, /KEEP_ASPECT_RATIO, $ >> /NOINTERP, /ERASE >> contour,im, Position=thisPosition,/xsty,/ysty,/noerase,$ >> scale_vector(findgen(9), 0, 9), scale_vector(findgen(9), 0, 9) > > I don't know. What do you think of this: > > im = dist(9) > im[2,2] = 15 > im[4:5, 4:5] = 10 > thispostion = [0.1, 0.1, 0.9, 0.9] > TVIMAGE, bytscl(im), POSITION=thisPosition, /KEEP_ASPECT_RATIO, $ > /NOINTERP, /ERASE > contour,im, Position=thisPosition,/xsty,/ysty,/noerase,$ > scale_vector(findgen(9), 0, 9), scale_vector(findgen(9), 0,9), $ > level = 6 > > isocontour, im, v, c, c_value = 6 > Plots, v[0,0:6]+0.5, v[1,0:6]+0.5, color=fsc_color('dodger blue') > Plots, v[0,7:*]+0.5, v[1,7:*]+0.5, color=fsc_color('dodger blue') > > > Note how I have to add a half pixel to the ISOCONTOUR to get > it anywhere near where I want it. Weird. > > 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.")
creator: pgrigis
date: 2008-02-29T19:15:38-00:00

Re: Overlaying a contour on a small image
type: item
description: On Feb 29, 1:41 pm, David Fanning <n...@dfanning.com> wrote: > Isn't this what you want: > > im = dist(9) > thispostion = [0.1, 0.1, 0.9, 0.9] > TVIMAGE, bytscl(im), POSITION=thisPosition, /KEEP_ASPECT_RATIO, $ > /NOINTERP, /ERASE > contour,im, Position=thisPosition,/xsty,/ysty,/noerase,$ > scale_vector(findgen(9), 0, 9), scale_vector(findgen(9), 0, 9) > I don't think any type of scaling is going to work. (The above example does not match the contour overlay with the single high pixel.) The point is that there really is no contour information at the half-pixel edges, since contours depend on the change between pixels. (You can display an image of 1 pixel, but you can't contour 1 pixel.) The program sent by Paolo (thanks!) works by not displaying the outer half pixel where there is no contour information. I actually like this approach. The ISOCONTOUR routine looks like it could be used to extrapolate contours to the outer half pixel, perhaps in an easier way than the PATH_XY keyword to CONTOUR. Cheers, --Wayne
creator: wlandsman
date: 2008-02-29T20:31:11-00:00