Hi David,
Thanks for the response!
Does the aspect keyword just keep the aspect ratio of the contour plot the same? I've been running it with multiple contour plots and it looks like the plot width/height is remaining constant while the distances between my tick marks have to adjust to that constant plot and so the distances between my x-ticks and y-ticks are not matching up so my contour does not look right proportionally :(
I'm looking for something where my plot width/height will adjust to keep a constant spacing between tick marks. Like, if there is 1 inch between x=0 and x=10, so then there should also be 1 inch between y=0 and y=10. Depending on what I'm plotting, sometimes my y-axis will go from -10 to 10 and my x-axis will go from -20 to 20, so I want to plot size to be smaller in the y-direction...it should only cover 2 inches whereas my x-axis should cover 4 if we use the example above. Or if my y-axis goes from -15 to 25 and my x from 0 to 10, my y-axis should cover 4 inches and x should cover 1.
Maybe I am doing it incorrectly? Updated code below:
cgContour,z,x,y, /Fill,$
levels=levels, C_colors=Indgen(numLevels(1))+1,$
c_labels=levels, /Outline,$
xminor=5, yminor=5,$
xtickinterval=10, ytickinterval=10,$
xticks=20,yticks=20,$
xstyle=1, ystyle=1,$
Aspect=1.0, /Window
Or would this depend more on the Window than the contour?
Thanks for all the help!
On Thursday, July 12, 2012 1:44:35 PM UTC-7, David Fanning wrote:
> ecatcom1@gmail.com writes:
>
> > Hi All! I have a seemingly-simple issue that I can't for the life of me get to work, and another issue mainly of existence.
> >
> > The first: I am trying to get a contour plot to plot with the spacing between minor/major ticks to be the same in the x and y direction. No matter what I try, I can't get this to work. I need to size of the plot itself to be able to change (so if i have 10 major ticks in x and 20 in y, I don't want the plot to be that size when, say, the next plot has 5 ticks in x and 15 in y because then the spacing between the x and y ticks won't be the same). Hope that made sense!
> >
> > Here's my code:
> >
> > cgContour,z,x,y, /Fill,$ ;Position=[0.125,0.025,0.9,0.8] I had a colorbar, but I can't hardcode a size to this plot since it will mess with my tick interval lengths depending on number of ticks I have, so commented this out
> > levels=levels, C_colors=Indgen(numLevels(1))+1,$
> > c_labels=levels, /Outline,$
> > xminor=5, yminor=5,$ ;tried hardcoding the number of minor ticks
> > xtickinterval=10, ytickinterval=10,$ ;tried hardcoding the interval size
> > xticks=20,yticks=20,$ ;even tried hardcoding the number of ticks
> > xstyle=1, ystyle=1,$
> > xrange=[-20,20],yrange=[-20,20], /Window ;and tried to give it the same range as a last desperate plea to see if it would give me the same distance between ticks....but nope.
> > Help!
>
> Here it took me two minutes to add an ASPECT keyword to cgContour plot
> for you. Set the ASPECT=1.0 and you will have what you want:
>
> cgContour, ..., Aspect=1.0, /Window
>
> Find the new program here:
>
> http://www.idlcoyote.com/programs/cgcontour.pro
>
> > The second issue: Is there a contour plot option anywhere that will >
> > allow me to dynamically change the x and y range so i can zoom in/out?
>
> Alas, not on a filled contour. It would be MUCH easier if you
> gridded your data yourself and worked with the gridded data
> as an image. Then almost anything is possible. :-)
>
> 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.")
|