[pyngl-talk] contour path coordinates

Fearon, Dr. Matthew, Contractor, Code 7533 matthew.fearon.ctr at nrlmry.navy.mil
Mon Aug 5 10:19:57 MDT 2019

Hi PyNGL users,

I was curious if it is possible to capture the contour paths (the
coordinates of them) after a plot has been made in Ngl (I pasted some code
below)? The equivalent in matplotlib would be the following. 

Thanks for the help,





clevels = [2]

cn = plt.contour(lon2d,lat2d,temp, levels=clevels)


for i in cn.collections:

    #loop over all contours per level

    for contour_path in i.get_paths():





  cnres.cnFillOn                   = True

    #cnres.cnFillMode                 = "RasterFill"

    cnres.cnLinesOn                  = False

    cnres.cnLineLabelsOn             = False

    cmap                             =

    cnres.cnFillPalette              = cmap

    cnres.cnLevelSelectionMode       = "ManualLevels"

    cnres.cnMaxLevelValF             = 70.

    cnres.cnMinLevelValF             = 2.

    cnres.cnLevelSpacingF            = 2

    cnres.lbAutoManage               = False

    cnres.pmLabelBarWidthF           = 0.018

    cnres.lbLabelFontHeightF         = 0.009

    cnres.lbLabelStride              = 2

    contour_plot                     = Ngl.contour(wks,cvar,cnres)



    print contour_plot.ncontour

    print dir(contour_plot)

['__doc__', '__module__', 'base', 'cafield', 'contour', 'labelbar',
'legend', 'map', 'nbase', 'ncafield', 'ncontour', 'nlabelbar', 'nlegend',
'nmap', 'nprimitive', 'nsffield', 'nstreamline', 'ntext', 'nvector',
'nvffield', 'nxy', 'nxydspec', 'primitive', 'sffield', 'streamline', 'text',
'vector', 'vffield', 'xy', 'xydspec']


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.ucar.edu/pipermail/pyngl-talk/attachments/20190805/adbb6595/attachment.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: smime.p7s
Type: application/pkcs7-signature
Size: 5442 bytes
Desc: not available
URL: <http://mailman.ucar.edu/pipermail/pyngl-talk/attachments/20190805/adbb6595/attachment.p7s>

More information about the pyngl-talk mailing list