Re: contours negative dashed, positive solid, zero thick

From: Mary Haley <haley_at_nyahnyahspammersnyahnyah>
Date: Wed, 20 Oct 2004 12:29:03 -0600 (MDT)

> A very basic plot: stereographic, (90N, 270E) contours of psl anomaly
> every 8 mb, negative dashed, positive solid, zero thicker or not
> plotted.
> How do I do this?
> I can get everything up to manipulating the line patterns of the
> contour lines. Using Dennis Shea's GSUN code, i can see that I need to
> set the patterns for each line. I managed to get the contour levels by
> the following lines of code:
> map = Ngl.contour_map(wks,pslAnom,resources)
> levels = Ngl.get_float_array(map.contour,"cnLevels")
> then I tried to set some resources:
> cnLineDashPatterns = N.zeros((len(levels),), N.Float)
> cnLineThicknesses = N.ones((len(levels),), N.Float)
> for i in range(len(levels)):
> if levels[i] < 0.:
> cnLineDashPatterns[i] = 1
> elif levels[i] > 0.:
> cnLineDashPatterns[i] = 0
> else:
> cnLineDashPatterns[i] = 0
> cnLineThicknesses[i] = 3
> resources.cnLineThicknesses = cnLineThicknesses
> resource.cnLineDashPatterns = cnLineDashPatterns
> resources.cnLineDashPatterns = cnLineDashPatterns
> map = Ngl.contour_map(wks,pslAnom,resources)
> But this did not seem to work - so how do you do it?
> --Jim


I believe you need to set a few more resources. Namely, by default,
the patterns and colors default to using just one color, even if the
plural versions of these resources (cnLineDashPatterns,
cnLineThicknesses, etc) are set.

You have to set the Mono resources to False to tell it to use the
plural version of these resources:

  resources.cnMonoLineThickness = False
  resources.cnMonoLineDashPattern = False

This is somewhat of an annoyance.

This may be a case of resources that should get set on the user's
behalf: if the plural version of these resources are set, then PyNGL
should step in and set the corresponding Mono resource to False.

It behaves this way for cnFillColors (at the low level), and I'm
not sure why it doesn't behave this way for the other ones.

I'll talk to one of our developers and see if there's any issue with
us automatically setting these Mono resources for you


pyngl-talk mailing list
Received on Wed Oct 20 2004 - 12:29:32 MDT

This archive was generated by hypermail 2.2.0 : Thu Jan 19 2006 - 21:30:16 MST