Dash/line patterns

There are 17 predefined dash patterns available:

You can also make your own dash pattern using the Ngl.new_dash_pattern function. See XY example multi_y.py and its output.

You can change the line style by using gsLineDashPattern for lines associated with polylines or Ngl.add_polyline, Ngl.polyline, Ngl.polyline_ndc.

For xy plots, use xyDashPattern or xyDashPatterns (more than one line on a plot).

The line style is changed using an integer from 0 to 16, or using an integer returned from Ngl.new_dash_pattern. The default is line index 0 (solid).

Code Snippets

res                    = Ngl.Resources()
res.gsLineDashPattern  = 4    
res.xyDashPattern      = 4    
res.xyDashPatterns     = [2,5,12]