PyNGL Home > Functions > Graphics routines

Ngl.add_polymarker

Adds polymarkers to an existing plot.

Prototype

pmarker = Ngl.add_polymarker(wks, plot, x, y, res=None)

Arguments

wks

The identifier returned from calling Ngl.open_wks.

plot

The id of the plot which you want to add the polymarkers to.

x, y

One-dimensional (masked) NumPy arrays or Python lists containing the x, y coordinates of the polymarkers.

res=None

An (optional) instance of the Resources class having GraphicStyle resources as attributes.

Return value

pmarker

A PlotId representing the polymarker added.

Description

This function adds polymarkers to the requested plot. plot is the value returned from a previous call to one of the PyNGL plotting functions, like Ngl.xy, Ngl.contour_map, etc. x and y are 1-dimensional arrays (these can be Python lists or tuples, or NumPy arrays) defining the coordinates of the polymarkers, and resources can optionally contain an unlimited number of attributes that are GraphicStyle resource names and their values. Note that x and y must be in the same data space as the data in plot.

Note: unlike Ngl.polymarker, this function does not actually draw the polymarkers. It only attaches the polymarkers to the given plot. You need to call Ngl.draw on plot in order to see the plot with the markers added.

If you plan to resize your plot or use it in a call to Ngl.panel, then it is better to use this function (rather than Ngl.polymarker) because the polymarkers will automatically get resized with the plot.

If you call this function multiple times, you should use a unique variable to hold the id returned.

As of version 1.3.0, there is automatic handling of missing data if one or both of the input arrays are masked arrays. Missing data will not be plotted.

See Also

Ngl.polymarker, Ngl.polymarker_ndc, Ngl.add_polyline, Ngl.add_polyline, Ngl.add_polygon

Examples

See the example xy2.py and its its output.