PDA

View Full Version : contour routine not working anymore?



Unregistered
10-04-2006, 03:39 PM
I have some code that used to work using contour to map plot coordinates to image coordinates like:

tvscl,img
contour,img,Position=[0,0,ncol,nrow],/device,/noerase
oplot,xvec,yvec,Position=[0,0,ncol,nrow],/device,/noerase

Now for some reason on a 640x480 image it doesn't map correctly as quickly evidenced by the fact the contours don't line up on the right part of the image.

Am I doing something wrong here?
Has the code changed?
Is there a better way to do this.

allan
10-05-2006, 07:39 PM
; use xstyle and ystyle:
img = dist(640,480)
ncol = (size(img))(1)
nrow = (size(img))(2)
tvscl,img
contour,img,Position=[0,0,ncol,nrow],/device,/noerase,/xstyle,/ystyle

Unregistered
10-10-2006, 11:07 AM
Not sure why xstyle and ystyle makes a difference... but it works!
Thanks!

donb
10-11-2006, 01:40 PM
The reason adding the Xstyle and Ystyle keywords to the CONTOUR command works is because the default behavior is to perform axis rounding of 5% of the actual axis ranges. By adding "/Xstyle, /YStyle" to the command, it tells PV-WAVE to use exact scaling for each of the axis ranges.

The final effect is that now the image and the lines of the contour should match!

Don B.