RE: [pyngl-talk] Contour plot maps using pyNGL

From: Mary Haley <haley_at_nyahnyahspammersnyahnyah>
Date: Thu, 19 Jun 2008 10:43:55 -0600 (MDT)

On Thu, 19 Jun 2008, Yuval Itan wrote:

>
> Thanks a lot for that Mary. Is there any way to constrain the contour plot for "land" only? That's because it is data regarding human populations, so ocean/lakes are irrelevant for the contour.
>
> Thanks again,
>
> Yuval

Yuval,

You can do this one of two ways: by filling the ocean in a specific
color (or just transparent), or specifying a set of areas you want to
mask.

Doing it the first way is probably a little easier to understand.
You would set the following resources:

   res.mpFillOn = True
   res.mpFillDrawOrder = "PostDraw"
   res.mpOceanFillColor = "white"
   res.mpLandFillColor = -1 # Transparent

You have to set the land fill color, because setting "mpFillOn" to
True makes all areas filled by default.

Some examples in the gallery show how to do this kind of filling or
masking, like examples "ctnccl", "clmdiv1", "ngl05p", "cn12p" (a bit
more complicated), and "panel2".

--Mary

> ----------------------------------------
>> Date: Thu, 19 Jun 2008 09:46:35 -0600
>> From: haley_at_ucar.edu
>> To: uvtravel_at_hotmail.com
>> CC: pyngl-talk_at_ucar.edu
>> Subject: Re: Contour plot maps using pyNGL
>>
>>
>> On Thu, 19 Jun 2008, Yuval Itan wrote:
>>
>>>
>>> Dear all,
>>>
>>> I would be grateful for advice regarding how to perform the following.
>>>
>>> I need to make a contour plot on the Eurasia map, longitude range of -15 to 85, and latitude range of 30 to 75. My values are frequency data of lactase persistence in about 50 locations around Eurasia.
>>>
>>> Any hint would be much appreciated.
>>>
>>> Thanks.
>>
>> Dear Yuval Itan,
>>
>> I've attached a sample PyNGL script (and png image) that creates a
>> mercator map with the lat/lon limits you gave, and some dummy data
>> overlaid.
>>
>> You can tweak and add resources (the "res" attributes) to further
>> customize your map and contours. You can change things like the map
>> projection, the color map, the size and font of your main title, the
>> location of your labelbar, etc.
>>
>> The thing you will probably want to change are the sf* resources I
>> set. The way they are set now, it's assuming that your values are
>> evenly spaced across longitude and latitude. If you have arrays that
>> define your lat/lon coordinates, then you'll want to set sfXArray and
>> sfYArray instead.
>>
>> To help you get started with all this, you can visit our gallery
>> (which has downloadable PyNGL and PyNIO scripts) at:
>>
>> http://www.pyngl.ucar.edu/Examples/gallery.shtml
>>
>> For specific examples on which examples use which resources (so you
>> can search for examples that use sfXArray and sfYArray), see:
>>
>> http://www.pyngl.ucar.edu/Examples/resources.shtml
>>
>> If you are really new to PyNGL and/or Python, then you can check
>> out our line-by-line tutorial:
>>
>> http://www.pyngl.ucar.edu/Tutorial/
>>
>> --Mary
> _________________________________________________________________
> Connect to the next generation of MSN Messenger 
> http://imagine-msn.com/messenger/launch80/default.aspx?locale=en-us&source=wlmailtagline
>

_______________________________________________
pyngl-talk mailing list
pyngl-talk_at_ucar.edu
http://mailman.ucar.edu/mailman/listinfo/pyngl-talk
Received on Thu Jun 19 2008 - 10:43:55 MDT

This archive was generated by hypermail 2.2.0 : Thu Jun 19 2008 - 10:44:30 MDT