Re: Contour Plot Issues [message #80826 is a reply to message #80821] |
Fri, 13 July 2012 13:42   |
Oana Coman
Messages: 27 Registered: December 2011
|
Junior Member |
|
|
Whoops! Light bulb just turned on!
New Code:
xrange=[xmin,xmax]
yrange=[ymin,ymax]
numLevels=size(levels)
LoadCT, 33, NColorS=numLevels(1), Bottom=1
xran=xmax-xmin
yran=ymax-ymin
asp=yran/xran
cgContour,aa,x(ix),y(iy), /Fill,$
levels=levels, C_colors=Indgen(numLevels(1))+1,$
c_labels=levels, /Outline,$
xminor=5, yminor=5,$
xrange=xrange, yrange=yrange,$
xtickinterval=10, ytickinterval=10,$
ASPECT=asp,/Window
When I am resizing my window, it keeps the aspect radio the same. Yay!
The problem is my plot doesnt show the correct aspect ratio. For example, I just plotted something with x=[-12,11] y=[-34,33], asp=2.91304 (i put a stop in my code and checked to see that all these values are correct and they are). But when it actually plots, the y-axis looks almost 5 times bigger than the x...which is not what I told it to do.
Any ideas why this could be happening? Is my code funky?
Thanks for putting up with my sillyness!
On Friday, July 13, 2012 12:33:57 PM UTC-7, David Fanning wrote:
> ecatcom1@gmail.com writes:
>
> > That's the big problem, though. I don't know ahead of time how my plot is going to look. I am working with someone's GUI. There's an IDL draw widget where I'm defining a region of interest, and depending on that region of interest my program computes an autocorrelation and then plots the results. So the shape of my plot will depend on the shape of the ROI, and since I'm not actually inputting numbers for this ROI but clicking and dragging in that window to create a
> rectangle, I don't have a way of knowing what those dimensions are before the plot (so I can't hardcode an aspect ratio ahead of time).
> > I feel like there has to be some way to define the plot size using the x range and y range that will still give me even tick spacing in both axes, or some way to just make the contour plot have those even tick spacings. I just don't know what it is :(
>
> Well, you can continue to believe this if you like. Good
> luck with this!
>
> But, if you are the one creating the ROI, and you seem to have
> some notion of the xrange and yrange, then I'd be willing to
> bet some money you have enough information to set the aspect
> ratio of the plot correctly. :-)
>
> Cheers,
>
> David
>
>
>
> --
> David Fanning, Ph.D.
> Fanning Software Consulting, Inc.
> Coyote's Guide to IDL Programming: http://www.idlcoyote.com/
> Sepore ma de ni thui. ("Perhaps thou speakest truth.")
|
|
|