Re: clipping with polyfill [message #29949 is a reply to message #29948] |
Tue, 26 March 2002 12:11  |
David Fanning
Messages: 11724 Registered: August 2001
|
Senior Member |
|
|
Charlie Zender (zender@uci.edu) writes:
> I am using IDL 5.2 under Linux and having problems with clipping.
> I am using polyfill to shade regions on an xy plot.
> Some of the polygon vertices fall outside the axis ranges and so
> I want to clip the polyfill so that the shading stays within the axes,
> and so that the filling does not obscure the tickmarks on the axes,
> so I do
>
> clp=[!x.crange(0)+0.5,!y.crange(0),!x.crange(1)-0.5,!y.crang e(1)]
> polyfill,x,y,clip=clp
>
> but the results show no clipping. the values of !x,y.crange all
> look reasonable so I am confused why the clipping does not appear to
> work either on screen or when sent to postscript. Any ideas?
The CLIP keyword only works with vector output with
the POLYFILL command. You aren't using vector output. :-(
I can imagine how to do your own clipping in the X direction
of the plot (where values are increasing in value), but I can't
see how to clip in the Y direction without a LOT of trouble.
(It's no picnic for the X direction, but--as I say--I can
imagine how it is done, given the previous constraints of your
problem.
I guess the question is, how general does this have to be?
If you want to clip on "data boundaries", it is easy, you
just do something like this:
Polyfill, xclip[0] > [x1, Reverse(x2)] < xclip[1], $
[y1, Reverse(y2)], Color=100
Where the xclip vector just contains the x data values
where you want to clip. If you want to clip in an
arbitrary way, you are going to have to find out
which data value is closest to your clipping point
(you can use a distance test), and either replace
that value (or the one next to it) with the clipping
value (depending upon whether the data value is greater
or lesser than the clipping value) before you clamp
as above.
It's a lot of trouble for sure. But if your problem is
constrained enough, you may be able to get it to work.
Cheers,
David
>
> I was also surprised that postscript printing does not support the
> pattern fill option in polyfill, but at least the manual documented
> this "feature".
>
>
--
David W. Fanning, Ph.D.
Fanning Software Consulting
Phone: 970-221-0438, E-mail: david@dfanning.com
Coyote's Guide to IDL Programming: http://www.dfanning.com/
Toll-Free IDL Book Orders: 1-888-461-0155
|
|
|