[pyngl-talk] Possible to plot on map without filling polygons ?

Mary Haley haley at ucar.edu
Tue Nov 7 09:16:05 MST 2017


Xianoni,

In the script I sent you yesterday, I tried making gsMarkerSizeF large with:

  mkres_filled.gsMarkerSizeF      = 0.01

  mkres_hollow.gsMarkerSizeF      = 0.03

and got much bigger squares. The hollow square was 3x times larger than the
filled square, which is correct. Are you sure you are changing the right
values?  What version of PyNGL do you have?

If you continue to have problems, it would help to see your script.

--Mary



On Tue, Nov 7, 2017 at 5:51 AM, Xiaoni Wang <xiaoni.wang at obspm.fr> wrote:

> Hi Mary,
>      I tried several values for gsMarkerSizeF gsMarkerThicknessF, as well
> as Ngl.new_marker(wks,"y",35,0,0,1,5,0.).  But it seems that they did not
> change the marker size in the figure ? Thanks in advance if you have any
> suggestion !
>
> Best wishes
>
> Xiaoni
>
>
> Le 6 nov. 2017 à 22:37, xiaoni wang <xiaoni.wang at obspm.fr> a écrit :
>
> Hi Mary
>     Thank you very much for your quick response et helpful example code !
> The third figure is what I like and I will try doing it.
>
> Best wishes,
>
> Xiaoni
>
> Le 6 nov. 2017 à 22:18, Mary Haley <haley at ucar.edu> a écrit :
>
> Xiaoni,
>
> I would recommend using Ngl.add_polymarker instead of trying to contour
> the data.
>
> You can group the markers by whatever criteria you choose, and then draw
> this set of markers all at once setting the color via gsMarkerColor.  You
> can change what type of marker is drawn by using gsMarkerIndex.
>
> We don't have many PyNGL examples of this yet, but you can see some NCL
> examples which are similar.  Go to:
>
> http://www.ncl.ucar.edu/Applications/polyg.shtml
>
> and look at examples polyg_8.ncl, polyg_8_lbar.ncl
>
> I've attached an example, along with its data file, to show the difference
> between smoothed contours, raster contours, and drawing markers.
>
> --Mary
>
>
>
> On Mon, Nov 6, 2017 at 6:17 AM, Xiaoni Wang <xiaoni.wang at obspm.fr> wrote:
>
>> Hi Dear Mary,
>>      Thank you for your explanation. (Excuse me for my late response).
>>
>>      I have another question. I have some 1D data irregularly distributed
>> over a region. I would like to plot these data on a 2D map, without
>> gridding, without filling polygons or triangles. I just would like to
>> show data in different colors (given different values) at their lat/lon
>> locations.
>>      For your information, it is over a small region (3 by 3 degree for
>> the latitude/longitude range), and number of data is not enormous over the
>> region. I tried contour_map with resources.cnFillOn=True,
>> resources.cnFillMode=RasterFill;  and it works. But it used TriangularMesh.
>> If I set resources.cnFillOn=False, then it  produces no points or color
>> on the map. If you have any suggestion, then I would appreciate !
>>
>>       PS: If there is no way to display as I wished, then I would like
>> just to add the data locations on the contour_map. Thanks in advance for
>> your help.
>>
>> Best regards
>>
>> Xiaoni
>>
>> Le 27 oct. 2017 à 00:37, Mary Haley <haley at ucar.edu> a écrit :
>>
>> Xiaoni,
>>
>> I'm sorry for the delay. I didn't realize there was an unanswered
>> question.
>>
>> When you say "specific value with white color" do you mean that you want
>> to color a 0-level contour line in white, or that you want to specify a
>> contour *fill* for values equal to 0?
>>
>> As an example of specifying a particular color for a contour line, see
>> spaghetti.py at:
>>
>> http://www.pyngl.ucar.edu/Examples/gallery.shtml
>>
>> This uses only one contour level, and sets the color for this level using
>> cnLineColor and an index value:
>>
>> res.cnLevelSelectionMode = "ExplicitLevels" # explicit contour levels
>> res.cnLevels             = 5500             # which level(s) to plot
>> res.cnLineColor          = 1      # index 1 in default color table. Can
>> also
>>                                   # use a named color, like "white"
>>
>>
>> If you want to set multiple levels with multiple colors, then provide an
>> array of values to cnLevels, and use cnLineColors to set the color for each.
>>
>> If you want to set the colors for filling between contour levels, then
>> you can use cnFillColors. See example hdf3.py, which does this with:
>>
>> res.cnLevelSelectionMode = "ExplicitLevels"
>> res.cnLevels             = [0.01,0.02,0.04,0.08,0.16,0.32,0.64, 0.96]
>> res.cnFillColors         = ["white","cyan", "green","yellow",
>>                             "darkorange","red","magenta","
>> purple","black"]
>>
>> --Mary
>>
>>
>>
>> On Thu, Oct 19, 2017 at 3:41 AM, Xiaoni Wang <xiaoni.wang at obspm.fr>
>> wrote:
>>
>>> Hi all,
>>>      May I ask how to plot a specific value (0 for example) with white
>>> color by using NGL in a 2D contour plot ? Thank you in advance !
>>>
>>> Best wishes,
>>>
>>> Xiaoni Wang
>>>
>>> _______________________________________________
>>> pyngl-talk mailing list
>>> List instructions, subscriber options, unsubscribe:
>>> http://mailman.ucar.edu/mailman/listinfo/pyngl-talk
>>>
>>
>>
>>
> <contour1d_1.py><contour1d.png><pw.dat>
>
>
> _______________________________________________
> pyngl-talk mailing list
> List instructions, subscriber options, unsubscribe:
> http://mailman.ucar.edu/mailman/listinfo/pyngl-talk
>
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.ucar.edu/pipermail/pyngl-talk/attachments/20171107/85a1faba/attachment.html>


More information about the pyngl-talk mailing list