| |
- matplotlib.cm.ScalarMappable
-
- ContourSet(matplotlib.cm.ScalarMappable, ContourLabeler)
- ContourLabeler
-
- ContourSet(matplotlib.cm.ScalarMappable, ContourLabeler)
class ContourLabeler |
|
Mixin to provide labelling capability to ContourSet |
|
Methods defined here:
- break_linecontour(self, linecontour, rot, labelwidth, ind)
- break a contour in two contours at the location of the label
- clabel(self, *args, **kwargs)
- clabel(CS, **kwargs) - add labels to line contours in CS,
where CS is a ContourSet object returned by contour.
clabel(CS, V, **kwargs) - only label contours listed in V
keyword arguments:
* fontsize = None: as described in http://matplotlib.sf.net/fonts.html
* colors = None:
- a tuple of matplotlib color args (string, float, rgb, etc),
different labels will be plotted in different colors in the order
specified
- one string color, e.g. colors = 'r' or colors = 'red', all labels
will be plotted in this color
- if colors == None, the color of each label matches the color
of the corresponding contour
* inline = True: controls whether the underlying contour is removed
(inline = True) or not (False)
* fmt = '%1.3f': a format string for the label
- get_label_coords(self, distances, XX, YY, ysize, lw)
- labels are ploted at a location with the smallest
dispersion of the contour from a straight line
unless there's another label nearby, in which case
the second best place on the contour is picked up
if there's no good place a label isplotted at the
beginning of the contour
- get_label_width(self, lev, fmt, fsize)
- get the width of the label in points
- get_text(self, lev, fmt)
- get the text of the label
- labels(self, inline)
- locate_label(self, linecontour, labelwidth)
- find a good place to plot a label (relatively flat
part of the contour) and the angle of rotation for the
text object
- print_label(self, linecontour, labelwidth)
- if contours are too short, don't plot a label
- set_label_props(self, label, text, color)
- set the label properties - color, fontsize, text
- too_close(self, x, y, lw)
- if there's a label already nearby, find a better place
|
class ContourSet(matplotlib.cm.ScalarMappable, ContourLabeler) |
|
Create and store a set of contour lines or filled regions.
User-callable method: clabel
Useful attributes:
ax - the axes object in which the contours are drawn
collections - a silent_list of LineCollections or PolyCollections
levels - contour levels
layers - same as levels for line contours; half-way between
levels for filled contours. See _process_colors method. |
|
- Method resolution order:
- ContourSet
- matplotlib.cm.ScalarMappable
- ContourLabeler
Methods defined here:
- __init__(self, ax, *args, **kwargs)
- Draw contour lines or filled regions, depending on
whether keyword arg 'filled' is False (default) or True.
The first argument of the initializer must be an axes
object. The remaining arguments and keyword arguments
are described in ContourSet.contour_doc.
- changed(self)
- get_alpha(self)
- For compatibility with artists, return self.alpha
- set_alpha(self, alpha)
- For compatibility with artists, set self.alpha
Data and other attributes defined here:
- contour_doc = '\n contour and contourf draw contour lines... boundaries unless antialiased = False\n '
Methods inherited from matplotlib.cm.ScalarMappable:
- add_checker(self, checker)
- Add an entry to a dictionary of boolean flags
that are set to True when the mappable is changed.
- add_observer(self, mappable)
- whenever the norm, clim or cmap is set, call the notify
instance of the mappable observer with self.
This is designed to allow one image to follow changes in the
cmap of another image
- autoscale(self)
- Autoscale the scalar limits on the norm instance using the
current array
- autoscale_None(self)
- Autoscale the scalar limits on the norm instance using the
current array, changing only limits that are None
- check_update(self, checker)
- If mappable has changed since the last check,
return True; else return False
- get_array(self)
- Return the array
- get_clim(self)
- return the min, max of the color limits for image scaling
- notify(self, mappable)
- If this is called then we are pegged to another mappable.
Update our cmap, norm, alpha from the other mappable.
- set_array(self, A)
- Set the image array from numpy array A
- set_clim(self, vmin=None, vmax=None)
- set the norm limits for image scaling; if vmin is a length2
sequence, interpret it as (vmin, vmax) which is used to
support setp
ACCEPTS: a length 2 sequence of floats
- set_cmap(self, cmap)
- set the colormap for luminance data
ACCEPTS: a colormap
- set_colorbar(self, im, ax)
- set the colorbar image and axes associated with mappable
- set_norm(self, norm)
- set the normalization instance
- to_rgba(self, x, alpha=1.0, bytes=False)
- Return a normalized rgba array corresponding to x.
If x is already an rgb array, insert alpha; if it is
already rgba, return it unchanged.
If bytes is True, return rgba as 4 uint8s instead of 4 floats.
Methods inherited from ContourLabeler:
- break_linecontour(self, linecontour, rot, labelwidth, ind)
- break a contour in two contours at the location of the label
- clabel(self, *args, **kwargs)
- clabel(CS, **kwargs) - add labels to line contours in CS,
where CS is a ContourSet object returned by contour.
clabel(CS, V, **kwargs) - only label contours listed in V
keyword arguments:
* fontsize = None: as described in http://matplotlib.sf.net/fonts.html
* colors = None:
- a tuple of matplotlib color args (string, float, rgb, etc),
different labels will be plotted in different colors in the order
specified
- one string color, e.g. colors = 'r' or colors = 'red', all labels
will be plotted in this color
- if colors == None, the color of each label matches the color
of the corresponding contour
* inline = True: controls whether the underlying contour is removed
(inline = True) or not (False)
* fmt = '%1.3f': a format string for the label
- get_label_coords(self, distances, XX, YY, ysize, lw)
- labels are ploted at a location with the smallest
dispersion of the contour from a straight line
unless there's another label nearby, in which case
the second best place on the contour is picked up
if there's no good place a label isplotted at the
beginning of the contour
- get_label_width(self, lev, fmt, fsize)
- get the width of the label in points
- get_text(self, lev, fmt)
- get the text of the label
- labels(self, inline)
- locate_label(self, linecontour, labelwidth)
- find a good place to plot a label (relatively flat
part of the contour) and the angle of rotation for the
text object
- print_label(self, linecontour, labelwidth)
- if contours are too short, don't plot a label
- set_label_props(self, label, text, color)
- set the label properties - color, fontsize, text
- too_close(self, x, y, lw)
- if there's a label already nearby, find a better place
| |