comp.lang.idl-pvwave archive
Messages from Usenet group comp.lang.idl-pvwave, compiled by Paulo Penteado

Home » Public Forums » archive » Re: stippling or cross hatching in contour plot
Show: Today's Messages :: Show Polls :: Message Navigator
E-mail to friend 
Switch to threaded view of this topic Create a new topic Submit Reply
Re: stippling or cross hatching in contour plot [message #56148] Fri, 05 October 2007 14:47 Go to next message
David Fanning is currently offline  David Fanning
Messages: 11724
Registered: August 2001
Senior Member
MA writes:

> I have a couple of maps (contour plots with filled, colored contours)
> that I'd like to overlay with stippling or hatching without blocking
> the color underneath. Does anybody have a suggestion on this problem?
> I'm trying to mark areas with high or low significance in the plot. A
> simple contour doesn't work very well since the data is pretty noisy,
> and I end up getting a lot of lines.
>
> The only way to hatch things that I've found is with the c_orientation
> keyword in the contour procedure. My problem with that is that it will
> always hatch above the topmost defined level. I.e. if I want to hatch
> between values of 25 and 50, and set levels=[25,50], it will hatch
> above 50 as well. Also, it erases the colors underneath the hatched
> portions.

As usual with IDL contours, you can't let IDL choose the contours
for you. You have to choose them yourself, and the lowest one better
be conincident with the MIN(data) if you expect to make sense of
what you are doing. :-)

http://www.dfanning.com/tips/nlevels.html

I don't see how it can erase the colors underneath, unless
you forget to use the NOERASE keyword. But the hatching has
no choice but to be drawn on top of the color, assuming you
have drawn the colorsa before the hatching. If it seems
to be erasing, maybe the hatching is too dense. You could
lighten up on that.

> Or should I use polyfill instead? I've done stippling before by
> defining a pattern for polyfill. I think this would cover over the
> underlying color contours, too. Unless I redefine the pattern in each
> box with the correct color...

In direct graphics, POLYFILL and Contour just replace pixels,
they don't "cover" anything up. Perhaps you could create
an example of what you mean.

Cheers,

David

--
David Fanning, Ph.D.
Fanning Software Consulting, Inc.
Coyote's Guide to IDL Programming: http://www.dfanning.com/
Re: stippling or cross hatching in contour plot [message #56281 is a reply to message #56148] Mon, 08 October 2007 08:44 Go to previous message
MA is currently offline  MA
Messages: 15
Registered: August 2005
Junior Member
Hello David,
thanks for your comments. Here's a very short piece of code to
illustrate my problem.

;; create some data
array=FindGen(100)
array=Reform(array,10,10)

Window,2
loadct,2
;; contour data with color
contour,array,levels=indgen(100),c_colors=indgen(100)+1,/fil l
;; try to put hatching on top
contour, array,levels=[0,15,25],c_orientation=[45,-45,0],/fill,/
noerase
end

> As usual with IDL contours, you can't let IDL choose the contours
> for you. You have to choose them yourself, and the lowest one better
> be conincident with the MIN(data) if you expect to make sense of
> what you are doing. :-)
I've done that


> I don't see how it can erase the colors underneath, unless
> you forget to use the NOERASE keyword.
You were right, I forgot the NOERASE

Still, the problem remains that c_orientation will apply its hatching
to all levels above the ones specified. Run the code above and see
what I mean. All levels above 0 are hatched at 45deg angle, all levels
above 15 are hatched at 45 AND -45 deg angle, and all levels above 25
are hatched at 45, -45 and 0deg angle. If I specify only one value for
c_orientation=45, then the whole plot ends up being hatched at 45deg.
I can't figure out how to hatch only between 0 and 15, or 15 and 25,
for example.

I've tried using POLYFILL instead, with the pattern keyword, and
defining the pattern as a solid color for points where I don't want
stippling, and defining the pattern as solid color with a couple of
black dots where I do want stippling. It works, but the plot ends up
being made up of lots of little squares, which doesn't look as smooth
as the contour plot.

I hope this explanation is a little clearer.
Thanks!
  Switch to threaded view of this topic Create a new topic Submit Reply
Previous Topic: Re: Recognizing double precision?
Next Topic: Sharing program

-=] Back to Top [=-
[ Syndicate this forum (XML) ] [ RSS ] [ PDF ]

Current Time: Wed Oct 08 19:33:11 PDT 2025

Total time taken to generate the page: 0.00598 seconds