You are reading documentation for the unreleased version of Matplotlib. Try searching for the released version of this page instead?
Version 2.0.0b1.post7580.dev0+ge487118
matplotlib
Fork me on GitHub

This Page

matplotlib.pyplot.thetagrids

matplotlib.pyplot.thetagrids(*args, **kwargs)

Get or set the theta locations of the gridlines in a polar plot.

If no arguments are passed, return a tuple (lines, labels) where lines is an array of radial gridlines (Line2D instances) and labels is an array of tick labels (Text instances):

lines, labels = thetagrids()

Otherwise the syntax is:

lines, labels = thetagrids(angles, labels=None, fmt='%d', frac = 1.1)

set the angles at which to place the theta grids (these gridlines are equal along the theta dimension).

angles is in degrees.

labels, if not None, is a len(angles) list of strings of the labels to use at each angle.

If labels is None, the labels will be fmt%angle.

frac is the fraction of the polar axes radius at which to place the label (1 is the edge). e.g., 1.05 is outside the axes and 0.95 is inside the axes.

Return value is a list of tuples (lines, labels):

  • lines are Line2D instances
  • labels are Text instances.

Note that on input, the labels argument is a list of strings, and on output it is a list of Text instances.

Examples:

# set the locations of the radial gridlines and labels
lines, labels = thetagrids( range(45,360,90) )

# set the locations and labels of the radial gridlines and labels
lines, labels = thetagrids( range(45,360,90), ('NE', 'NW', 'SW','SE') )