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

Home » Public Forums » archive » stippling or cross hatching in contour plot
Show: Today's Messages :: Show Polls :: Message Navigator
E-mail to friend 
Return to the default flat view Create a new topic Submit Reply
Re: stippling or cross hatching in contour plot [message #56275 is a reply to message #56149] Mon, 08 October 2007 11:48 Go to previous messageGo to previous message
MA is currently offline  MA
Messages: 15
Registered: August 2005
Junior Member
Hello David,
thanks, that's definitely an improvement. However, I'm still trying to
hatch only between two levels (significant areas), not hatch all over
the plot. I've modified your code a bit, and now it's working. I
basically create a new array from the original, in which I set all
points I want to hatch to 1, all points I don't want to hatch over to
0, then contour at levels 1 and above.

;*********************************************************** **********
;; create some data
array=dist(10,10)

Window,2
loadct,2
;; contour data with color
loadct, 33, ncolors=5, bottom=1
device, decomposed=0, get_decomposed=theState

thisDevice = !D.Name
xsize = !D.X_Size
ysize = !D.Y_Size
Set_Plot, 'Z'
Device, Set_Resolution=[xsize,ysize], Z_Buffer=0
contour,array,levels=indgen(5),c_colors=indgen(5)+1,/fill, $
xstyle=1, ystyle=1, position=[0.1, 0.1, 0.9, 0.9]
;; try to put hatching on top
locx = [0.1, 0.9] * xsize
locy = [0.1, 0.9] * ysize
snap1 = TVRD(locx[0], locy[0], locx[1]-locx[0]+1, $
locy[1]-locy[0]+1)
;; create new array for hatching
newarray=array
;; set points I want to hatch over to 1
newarray[Where(array GT 2.5 AND array LT 5.)]=1.
;; set points I don't want to hatch over to 0
newarray[Where(array le 2.5 OR array ge 5.)]=0.
;; contour level=1 and some value above, which results in
;; hatching only over the area where the original array
;; had values between 2.5 and 5.
contour, newarray,levels=[1,2],/overplot, $
c_orientation=[45]
snap2 = TVRD(locx[0], locy[0], locx[1]-locx[0]+1, $
locy[1]-locy[0]+1)

Set_Plot, thisDevice
contour,array, xstyle=1, ystyle=1, /NoData, $
position=[0.1, 0.1, 0.9, 0.9]
TV, snap1 > snap2, locx[0], locy[0]
device, decomposed=theState
end
;*********************************************************** ***
[Message index]
 
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: Wanted: 4D multi-variate Data w/ u,v,w & t.
Next Topic: Re: moving to objects / IDL objects and object graphics

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

Current Time: Wed Oct 08 17:56:59 PDT 2025

Total time taken to generate the page: 0.00378 seconds