Clipping shade_surf [message #87002] |
Thu, 19 December 2013 07:49  |
e.grono
Messages: 3 Registered: December 2013
|
Junior Member |
|
|
I'm running IDL 8.2.0 and have been finding it impossible to successfully use the clip keyword with shade_surf despite the fact the IDL documentation says it should work. No error messages are displayed, the plot just appears without any clipping done. Surface can be clipped successfully so it shouldn't be my use of the keyword causing trouble. Anyone have any experience with this issue?
|
|
|
|
Re: Clipping shade_surf [message #87005 is a reply to message #87002] |
Thu, 19 December 2013 08:28   |
e.grono
Messages: 3 Registered: December 2013
|
Junior Member |
|
|
It doesn't take anything too complicated to demonstrate.
z=dist(100)
shade_surf,z,ax=90,az=0,xrange=[40,60],xstyle=1,clip=[40,0,6 0,100],noclip=0
I just want to crop out what goes outside the axes.
How it works with surface:
surface,z,ax=90,az=0,xrange=[40,60],xstyle=1
surface,z,ax=90,az=0,xrange=[40,60],xstyle=1,clip=[40,0,60,1 00],noclip=0
I could just chop out the data I don't want from the array I'm plotting but the resolution of my data set is low enough that when I force the x and y ranges I want I end up with little bars of empty space where there is no data.
|
|
|
Re: Clipping shade_surf [message #87006 is a reply to message #87005] |
Thu, 19 December 2013 08:51   |
David Fanning
Messages: 11724 Registered: August 2001
|
Senior Member |
|
|
e.grono@live.ca writes:
> It doesn't take anything too complicated to demonstrate.
> z=dist(100)
> shade_surf,z,ax=90,az=0,xrange=[40,60],xstyle=1,clip=[40,0,6 0,100],noclip=0
> I just want to crop out what goes outside the axes.
>
> How it works with surface:
> surface,z,ax=90,az=0,xrange=[40,60],xstyle=1
> surface,z,ax=90,az=0,xrange=[40,60],xstyle=1,clip=[40,0,60,1 00],noclip=0
>
> I could just chop out the data I don't want from the array I'm plotting but the resolution of my data set is low enough that when I force the x and y ranges I want I end up with little bars of empty space where there is no data.
Yes. I doubt you are going to be able to do this.
I think you might be better off to do something like this:
cgplot, [1], xrange=[40,60], yrange=[0,100], /nodata
cgimage, z, xrange=[40,60], yrange=[0,100], /overplot, /scale
That seems to give you the same thing, but you don't have to worry about
clipping the surface. If you wanted the shading to be Gouroud shading,
you could recover the image from Shade_Surf (I would use cgSurf), and
use that with cgImage, I suppose. The point is, cgImage will clip the 2D
array for you, given the current range of the axes.
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.")
|
|
|
|