doc_content stringlengths 1 386k | doc_id stringlengths 5 188 |
|---|---|
pick(mouseevent)[source]
Process a pick event. Each child artist will fire a pick event if mouseevent is over the artist and the artist has picker set. See also
set_picker, get_picker, pickable | matplotlib.figure_api#matplotlib.figure.SubFigure.pick |
pickable()[source]
Return whether the artist is pickable. See also
set_picker, get_picker, pick | matplotlib.figure_api#matplotlib.figure.SubFigure.pickable |
properties()[source]
Return a dictionary of all the properties of the artist. | matplotlib.figure_api#matplotlib.figure.SubFigure.properties |
remove()[source]
Remove the artist from the figure if possible. The effect will not be visible until the figure is redrawn, e.g., with FigureCanvasBase.draw_idle. Call relim to update the axes limits if desired. Note: relim will not see collections even if the collection was added to the axes with autolim = True. Note: there is no support for removing the artist's legend entry. | matplotlib.figure_api#matplotlib.figure.SubFigure.remove |
remove_callback(oid)[source]
Remove a callback based on its observer id. See also add_callback | matplotlib.figure_api#matplotlib.figure.SubFigure.remove_callback |
sca(a)[source]
Set the current Axes to be a and return a. | matplotlib.figure_api#matplotlib.figure.SubFigure.sca |
set(*, agg_filter=<UNSET>, alpha=<UNSET>, animated=<UNSET>, clip_box=<UNSET>, clip_on=<UNSET>, clip_path=<UNSET>, edgecolor=<UNSET>, facecolor=<UNSET>, frameon=<UNSET>, gid=<UNSET>, in_layout=<UNSET>, label=<UNSET>, linewidth=<UNSET>, path_effects=<UNSET>, picker=<UNSET>, rasterized=<UNSET>, sketch_params=<UNSET>, snap=<UNSET>, transform=<UNSET>, url=<UNSET>, visible=<UNSET>, zorder=<UNSET>)[source]
Set multiple properties at once. Supported properties are
Property Description
agg_filter a filter function, which takes a (m, n, 3) float array and a dpi value, and returns a (m, n, 3) array
alpha scalar or None
animated bool
clip_box Bbox
clip_on bool
clip_path Patch or (Path, Transform) or None
edgecolor color
facecolor color
figure Figure
frameon bool
gid str
in_layout bool
label object
linewidth number
path_effects AbstractPathEffect
picker None or bool or float or callable
rasterized bool
sketch_params (scale: float, length: float, randomness: float)
snap bool or None
transform Transform
url str
visible bool
zorder float | matplotlib.figure_api#matplotlib.figure.SubFigure.set |
set_agg_filter(filter_func)[source]
Set the agg filter. Parameters
filter_funccallable
A filter function, which takes a (m, n, 3) float array and a dpi value, and returns a (m, n, 3) array. | matplotlib.figure_api#matplotlib.figure.SubFigure.set_agg_filter |
set_alpha(alpha)[source]
Set the alpha value used for blending - not supported on all backends. Parameters
alphascalar or None
alpha must be within the 0-1 range, inclusive. | matplotlib.figure_api#matplotlib.figure.SubFigure.set_alpha |
set_animated(b)[source]
Set whether the artist is intended to be used in an animation. If True, the artist is excluded from regular drawing of the figure. You have to call Figure.draw_artist / Axes.draw_artist explicitly on the artist. This appoach is used to speed up animations using blitting. See also matplotlib.animation and Faster rendering by using blitting. Parameters
bbool | matplotlib.figure_api#matplotlib.figure.SubFigure.set_animated |
set_clip_box(clipbox)[source]
Set the artist's clip Bbox. Parameters
clipboxBbox | matplotlib.figure_api#matplotlib.figure.SubFigure.set_clip_box |
set_clip_on(b)[source]
Set whether the artist uses clipping. When False artists will be visible outside of the axes which can lead to unexpected results. Parameters
bbool | matplotlib.figure_api#matplotlib.figure.SubFigure.set_clip_on |
set_clip_path(path, transform=None)[source]
Set the artist's clip path. Parameters
pathPatch or Path or TransformedPath or None
The clip path. If given a Path, transform must be provided as well. If None, a previously set clip path is removed.
transformTransform, optional
Only used if path is a Path, in which case the given Path is converted to a TransformedPath using transform. Notes For efficiency, if path is a Rectangle this method will set the clipping box to the corresponding rectangle and set the clipping path to None. For technical reasons (support of set), a tuple (path, transform) is also accepted as a single positional parameter. | matplotlib.figure_api#matplotlib.figure.SubFigure.set_clip_path |
set_edgecolor(color)[source]
Set the edge color of the Figure rectangle. Parameters
colorcolor | matplotlib.figure_api#matplotlib.figure.SubFigure.set_edgecolor |
set_facecolor(color)[source]
Set the face color of the Figure rectangle. Parameters
colorcolor | matplotlib.figure_api#matplotlib.figure.SubFigure.set_facecolor |
set_figure(fig)[source]
Set the Figure instance the artist belongs to. Parameters
figFigure | matplotlib.figure_api#matplotlib.figure.SubFigure.set_figure |
set_frameon(b)[source]
Set the figure's background patch visibility, i.e. whether the figure background will be drawn. Equivalent to Figure.patch.set_visible(). Parameters
bbool | matplotlib.figure_api#matplotlib.figure.SubFigure.set_frameon |
set_gid(gid)[source]
Set the (group) id for the artist. Parameters
gidstr | matplotlib.figure_api#matplotlib.figure.SubFigure.set_gid |
set_in_layout(in_layout)[source]
Set if artist is to be included in layout calculations, E.g. Constrained Layout Guide, Figure.tight_layout(), and fig.savefig(fname, bbox_inches='tight'). Parameters
in_layoutbool | matplotlib.figure_api#matplotlib.figure.SubFigure.set_in_layout |
set_label(s)[source]
Set a label that will be displayed in the legend. Parameters
sobject
s will be converted to a string by calling str. | matplotlib.figure_api#matplotlib.figure.SubFigure.set_label |
set_linewidth(linewidth)[source]
Set the line width of the Figure rectangle. Parameters
linewidthnumber | matplotlib.figure_api#matplotlib.figure.SubFigure.set_linewidth |
set_path_effects(path_effects)[source]
Set the path effects. Parameters
path_effectsAbstractPathEffect | matplotlib.figure_api#matplotlib.figure.SubFigure.set_path_effects |
set_picker(picker)[source]
Define the picking behavior of the artist. Parameters
pickerNone or bool or float or callable
This can be one of the following:
None: Picking is disabled for this artist (default). A boolean: If True then picking will be enabled and the artist will fire a pick event if the mouse event is over the artist. A float: If picker is a number it is interpreted as an epsilon tolerance in points and the artist will fire off an event if its data is within epsilon of the mouse event. For some artists like lines and patch collections, the artist may provide additional data to the pick event that is generated, e.g., the indices of the data within epsilon of the pick event
A function: If picker is callable, it is a user supplied function which determines whether the artist is hit by the mouse event: hit, props = picker(artist, mouseevent)
to determine the hit test. if the mouse event is over the artist, return hit=True and props is a dictionary of properties you want added to the PickEvent attributes. | matplotlib.figure_api#matplotlib.figure.SubFigure.set_picker |
set_rasterized(rasterized)[source]
Force rasterized (bitmap) drawing for vector graphics output. Rasterized drawing is not supported by all artists. If you try to enable this on an artist that does not support it, the command has no effect and a warning will be issued. This setting is ignored for pixel-based output. See also Rasterization for vector graphics. Parameters
rasterizedbool | matplotlib.figure_api#matplotlib.figure.SubFigure.set_rasterized |
set_sketch_params(scale=None, length=None, randomness=None)[source]
Set the sketch parameters. Parameters
scalefloat, optional
The amplitude of the wiggle perpendicular to the source line, in pixels. If scale is None, or not provided, no sketch filter will be provided.
lengthfloat, optional
The length of the wiggle along the line, in pixels (default 128.0)
randomnessfloat, optional
The scale factor by which the length is shrunken or expanded (default 16.0) The PGF backend uses this argument as an RNG seed and not as described above. Using the same seed yields the same random shape. | matplotlib.figure_api#matplotlib.figure.SubFigure.set_sketch_params |
set_snap(snap)[source]
Set the snapping behavior. Snapping aligns positions with the pixel grid, which results in clearer images. For example, if a black line of 1px width was defined at a position in between two pixels, the resulting image would contain the interpolated value of that line in the pixel grid, which would be a grey value on both adjacent pixel positions. In contrast, snapping will move the line to the nearest integer pixel value, so that the resulting image will really contain a 1px wide black line. Snapping is currently only supported by the Agg and MacOSX backends. Parameters
snapbool or None
Possible values:
True: Snap vertices to the nearest pixel center.
False: Do not modify vertex positions.
None: (auto) If the path contains only rectilinear line segments, round to the nearest pixel center. | matplotlib.figure_api#matplotlib.figure.SubFigure.set_snap |
set_transform(t)[source]
Set the artist transform. Parameters
tTransform | matplotlib.figure_api#matplotlib.figure.SubFigure.set_transform |
set_url(url)[source]
Set the url for the artist. Parameters
urlstr | matplotlib.figure_api#matplotlib.figure.SubFigure.set_url |
set_visible(b)[source]
Set the artist's visibility. Parameters
bbool | matplotlib.figure_api#matplotlib.figure.SubFigure.set_visible |
set_zorder(level)[source]
Set the zorder for the artist. Artists with lower zorder values are drawn first. Parameters
levelfloat | matplotlib.figure_api#matplotlib.figure.SubFigure.set_zorder |
subfigures(nrows=1, ncols=1, squeeze=True, wspace=None, hspace=None, width_ratios=None, height_ratios=None, **kwargs)[source]
Add a subfigure to this figure or subfigure. A subfigure has the same artist methods as a figure, and is logically the same as a figure, but cannot print itself. See Figure subfigures. Parameters
nrows, ncolsint, default: 1
Number of rows/columns of the subfigure grid.
squeezebool, default: True
If True, extra dimensions are squeezed out from the returned array of subfigures.
wspace, hspacefloat, default: None
The amount of width/height reserved for space between subfigures, expressed as a fraction of the average subfigure width/height. If not given, the values will be inferred from a figure or rcParams when necessary.
width_ratiosarray-like of length ncols, optional
Defines the relative widths of the columns. Each column gets a relative width of width_ratios[i] / sum(width_ratios). If not given, all columns will have the same width.
height_ratiosarray-like of length nrows, optional
Defines the relative heights of the rows. Each row gets a relative height of height_ratios[i] / sum(height_ratios). If not given, all rows will have the same height. | matplotlib.figure_api#matplotlib.figure.SubFigure.subfigures |
subplot_mosaic(mosaic, *, sharex=False, sharey=False, subplot_kw=None, gridspec_kw=None, empty_sentinel='.')[source]
Build a layout of Axes based on ASCII art or nested lists. This is a helper function to build complex GridSpec layouts visually. Note This API is provisional and may be revised in the future based on early user feedback. Parameters
mosaiclist of list of {hashable or nested} or str
A visual layout of how you want your Axes to be arranged labeled as strings. For example x = [['A panel', 'A panel', 'edge'],
['C panel', '.', 'edge']]
produces 4 Axes: 'A panel' which is 1 row high and spans the first two columns 'edge' which is 2 rows high and is on the right edge 'C panel' which in 1 row and 1 column wide in the bottom left a blank space 1 row and 1 column wide in the bottom center Any of the entries in the layout can be a list of lists of the same form to create nested layouts. If input is a str, then it can either be a multi-line string of the form '''
AAE
C.E
'''
where each character is a column and each line is a row. Or it can be a single-line string where rows are separated by ;: 'AB;CC'
The string notation allows only single character Axes labels and does not support nesting but is very terse.
sharex, shareybool, default: False
If True, the x-axis (sharex) or y-axis (sharey) will be shared among all subplots. In that case, tick label visibility and axis units behave as for subplots. If False, each subplot's x- or y-axis will be independent.
subplot_kwdict, optional
Dictionary with keywords passed to the Figure.add_subplot call used to create each subplot.
gridspec_kwdict, optional
Dictionary with keywords passed to the GridSpec constructor used to create the grid the subplots are placed on.
empty_sentinelobject, optional
Entry in the layout to mean "leave this space empty". Defaults to '.'. Note, if layout is a string, it is processed via inspect.cleandoc to remove leading white space, which may interfere with using white-space as the empty sentinel. Returns
dict[label, Axes]
A dictionary mapping the labels to the Axes objects. The order of the axes is left-to-right and top-to-bottom of their position in the total layout. | matplotlib.figure_api#matplotlib.figure.SubFigure.subplot_mosaic |
subplots(nrows=1, ncols=1, *, sharex=False, sharey=False, squeeze=True, subplot_kw=None, gridspec_kw=None)[source]
Add a set of subplots to this figure. This utility wrapper makes it convenient to create common layouts of subplots in a single call. Parameters
nrows, ncolsint, default: 1
Number of rows/columns of the subplot grid.
sharex, shareybool or {'none', 'all', 'row', 'col'}, default: False
Controls sharing of x-axis (sharex) or y-axis (sharey): True or 'all': x- or y-axis will be shared among all subplots. False or 'none': each subplot x- or y-axis will be independent. 'row': each subplot row will share an x- or y-axis. 'col': each subplot column will share an x- or y-axis. When subplots have a shared x-axis along a column, only the x tick labels of the bottom subplot are created. Similarly, when subplots have a shared y-axis along a row, only the y tick labels of the first column subplot are created. To later turn other subplots' ticklabels on, use tick_params. When subplots have a shared axis that has units, calling Axis.set_units will update each axis with the new units.
squeezebool, default: True
If True, extra dimensions are squeezed out from the returned array of Axes: if only one subplot is constructed (nrows=ncols=1), the resulting single Axes object is returned as a scalar. for Nx1 or 1xM subplots, the returned object is a 1D numpy object array of Axes objects. for NxM, subplots with N>1 and M>1 are returned as a 2D array. If False, no squeezing at all is done: the returned Axes object is always a 2D array containing Axes instances, even if it ends up being 1x1.
subplot_kwdict, optional
Dict with keywords passed to the Figure.add_subplot call used to create each subplot.
gridspec_kwdict, optional
Dict with keywords passed to the GridSpec constructor used to create the grid the subplots are placed on. Returns
Axes or array of Axes
Either a single Axes object or an array of Axes objects if more than one subplot was created. The dimensions of the resulting array can be controlled with the squeeze keyword, see above. See also pyplot.subplots
Figure.add_subplot
pyplot.subplot
Examples # First create some toy data:
x = np.linspace(0, 2*np.pi, 400)
y = np.sin(x**2)
# Create a figure
plt.figure()
# Create a subplot
ax = fig.subplots()
ax.plot(x, y)
ax.set_title('Simple plot')
# Create two subplots and unpack the output array immediately
ax1, ax2 = fig.subplots(1, 2, sharey=True)
ax1.plot(x, y)
ax1.set_title('Sharing Y axis')
ax2.scatter(x, y)
# Create four polar Axes and access them through the returned array
axes = fig.subplots(2, 2, subplot_kw=dict(projection='polar'))
axes[0, 0].plot(x, y)
axes[1, 1].scatter(x, y)
# Share a X axis with each column of subplots
fig.subplots(2, 2, sharex='col')
# Share a Y axis with each row of subplots
fig.subplots(2, 2, sharey='row')
# Share both X and Y axes with all subplots
fig.subplots(2, 2, sharex='all', sharey='all')
# Note that this is the same as
fig.subplots(2, 2, sharex=True, sharey=True) | matplotlib.figure_api#matplotlib.figure.SubFigure.subplots |
subplots_adjust(left=None, bottom=None, right=None, top=None, wspace=None, hspace=None)[source]
Adjust the subplot layout parameters. Unset parameters are left unmodified; initial values are given by rcParams["figure.subplot.[name]"]. Parameters
leftfloat, optional
The position of the left edge of the subplots, as a fraction of the figure width.
rightfloat, optional
The position of the right edge of the subplots, as a fraction of the figure width.
bottomfloat, optional
The position of the bottom edge of the subplots, as a fraction of the figure height.
topfloat, optional
The position of the top edge of the subplots, as a fraction of the figure height.
wspacefloat, optional
The width of the padding between subplots, as a fraction of the average Axes width.
hspacefloat, optional
The height of the padding between subplots, as a fraction of the average Axes height. | matplotlib.figure_api#matplotlib.figure.SubFigure.subplots_adjust |
suptitle(t, **kwargs)[source]
Add a centered suptitle to the figure. Parameters
tstr
The suptitle text.
xfloat, default: 0.5
The x location of the text in figure coordinates.
yfloat, default: 0.98
The y location of the text in figure coordinates.
horizontalalignment, ha{'center', 'left', 'right'}, default: center
The horizontal alignment of the text relative to (x, y).
verticalalignment, va{'top', 'center', 'bottom', 'baseline'}, default: top
The vertical alignment of the text relative to (x, y).
fontsize, sizedefault: rcParams["figure.titlesize"] (default: 'large')
The font size of the text. See Text.set_size for possible values.
fontweight, weightdefault: rcParams["figure.titleweight"] (default: 'normal')
The font weight of the text. See Text.set_weight for possible values. Returns
text
The Text instance of the suptitle. Other Parameters
fontpropertiesNone or dict, optional
A dict of font properties. If fontproperties is given the default values for font size and weight are taken from the FontProperties defaults. rcParams["figure.titlesize"] (default: 'large') and rcParams["figure.titleweight"] (default: 'normal') are ignored in this case. **kwargs
Additional kwargs are matplotlib.text.Text properties. | matplotlib.figure_api#matplotlib.figure.SubFigure.suptitle |
supxlabel(t, **kwargs)[source]
Add a centered supxlabel to the figure. Parameters
tstr
The supxlabel text.
xfloat, default: 0.5
The x location of the text in figure coordinates.
yfloat, default: 0.01
The y location of the text in figure coordinates.
horizontalalignment, ha{'center', 'left', 'right'}, default: center
The horizontal alignment of the text relative to (x, y).
verticalalignment, va{'top', 'center', 'bottom', 'baseline'}, default: bottom
The vertical alignment of the text relative to (x, y).
fontsize, sizedefault: rcParams["figure.titlesize"] (default: 'large')
The font size of the text. See Text.set_size for possible values.
fontweight, weightdefault: rcParams["figure.titleweight"] (default: 'normal')
The font weight of the text. See Text.set_weight for possible values. Returns
text
The Text instance of the supxlabel. Other Parameters
fontpropertiesNone or dict, optional
A dict of font properties. If fontproperties is given the default values for font size and weight are taken from the FontProperties defaults. rcParams["figure.titlesize"] (default: 'large') and rcParams["figure.titleweight"] (default: 'normal') are ignored in this case. **kwargs
Additional kwargs are matplotlib.text.Text properties. | matplotlib.figure_api#matplotlib.figure.SubFigure.supxlabel |
supylabel(t, **kwargs)[source]
Add a centered supylabel to the figure. Parameters
tstr
The supylabel text.
xfloat, default: 0.02
The x location of the text in figure coordinates.
yfloat, default: 0.5
The y location of the text in figure coordinates.
horizontalalignment, ha{'center', 'left', 'right'}, default: left
The horizontal alignment of the text relative to (x, y).
verticalalignment, va{'top', 'center', 'bottom', 'baseline'}, default: center
The vertical alignment of the text relative to (x, y).
fontsize, sizedefault: rcParams["figure.titlesize"] (default: 'large')
The font size of the text. See Text.set_size for possible values.
fontweight, weightdefault: rcParams["figure.titleweight"] (default: 'normal')
The font weight of the text. See Text.set_weight for possible values. Returns
text
The Text instance of the supylabel. Other Parameters
fontpropertiesNone or dict, optional
A dict of font properties. If fontproperties is given the default values for font size and weight are taken from the FontProperties defaults. rcParams["figure.titlesize"] (default: 'large') and rcParams["figure.titleweight"] (default: 'normal') are ignored in this case. **kwargs
Additional kwargs are matplotlib.text.Text properties. | matplotlib.figure_api#matplotlib.figure.SubFigure.supylabel |
text(x, y, s, fontdict=None, **kwargs)[source]
Add text to figure. Parameters
x, yfloat
The position to place the text. By default, this is in figure coordinates, floats in [0, 1]. The coordinate system can be changed using the transform keyword.
sstr
The text string.
fontdictdict, optional
A dictionary to override the default text properties. If not given, the defaults are determined by rcParams["font.*"]. Properties passed as kwargs override the corresponding ones given in fontdict. Returns
Text
Other Parameters
**kwargsText properties
Other miscellaneous text parameters.
Property Description
agg_filter a filter function, which takes a (m, n, 3) float array and a dpi value, and returns a (m, n, 3) array
alpha scalar or None
animated bool
backgroundcolor color
bbox dict with properties for patches.FancyBboxPatch
clip_box unknown
clip_on unknown
clip_path unknown
color or c color
figure Figure
fontfamily or family {FONTNAME, 'serif', 'sans-serif', 'cursive', 'fantasy', 'monospace'}
fontproperties or font or font_properties font_manager.FontProperties or str or pathlib.Path
fontsize or size float or {'xx-small', 'x-small', 'small', 'medium', 'large', 'x-large', 'xx-large'}
fontstretch or stretch {a numeric value in range 0-1000, 'ultra-condensed', 'extra-condensed', 'condensed', 'semi-condensed', 'normal', 'semi-expanded', 'expanded', 'extra-expanded', 'ultra-expanded'}
fontstyle or style {'normal', 'italic', 'oblique'}
fontvariant or variant {'normal', 'small-caps'}
fontweight or weight {a numeric value in range 0-1000, 'ultralight', 'light', 'normal', 'regular', 'book', 'medium', 'roman', 'semibold', 'demibold', 'demi', 'bold', 'heavy', 'extra bold', 'black'}
gid str
horizontalalignment or ha {'center', 'right', 'left'}
in_layout bool
label object
linespacing float (multiple of font size)
math_fontfamily str
multialignment or ma {'left', 'right', 'center'}
parse_math bool
path_effects AbstractPathEffect
picker None or bool or float or callable
position (float, float)
rasterized bool
rotation float or {'vertical', 'horizontal'}
rotation_mode {None, 'default', 'anchor'}
sketch_params (scale: float, length: float, randomness: float)
snap bool or None
text object
transform Transform
transform_rotates_text bool
url str
usetex bool or None
verticalalignment or va {'center', 'top', 'bottom', 'baseline', 'center_baseline'}
visible bool
wrap bool
x float
y float
zorder float See also Axes.text
pyplot.text | matplotlib.figure_api#matplotlib.figure.SubFigure.text |
update(props)[source]
Update this artist's properties from the dict props. Parameters
propsdict | matplotlib.figure_api#matplotlib.figure.SubFigure.update |
update_from(other)[source]
Copy properties from other to self. | matplotlib.figure_api#matplotlib.figure.SubFigure.update_from |
zorder=0 | matplotlib.figure_api#matplotlib.figure.SubFigure.zorder |
classmatplotlib.figure.SubplotParams(left=None, bottom=None, right=None, top=None, wspace=None, hspace=None)[source]
A class to hold the parameters for a subplot. Defaults are given by rcParams["figure.subplot.[name]"]. Parameters
leftfloat
The position of the left edge of the subplots, as a fraction of the figure width.
rightfloat
The position of the right edge of the subplots, as a fraction of the figure width.
bottomfloat
The position of the bottom edge of the subplots, as a fraction of the figure height.
topfloat
The position of the top edge of the subplots, as a fraction of the figure height.
wspacefloat
The width of the padding between subplots, as a fraction of the average Axes width.
hspacefloat
The height of the padding between subplots, as a fraction of the average Axes height. update(left=None, bottom=None, right=None, top=None, wspace=None, hspace=None)[source]
Update the dimensions of the passed parameters. None means unchanged.
propertyvalidate[source] | matplotlib.figure_api#matplotlib.figure.SubplotParams |
update(left=None, bottom=None, right=None, top=None, wspace=None, hspace=None)[source]
Update the dimensions of the passed parameters. None means unchanged. | matplotlib.figure_api#matplotlib.figure.SubplotParams.update |
matplotlib.font_manager A module for finding, managing, and using fonts across platforms. This module provides a single FontManager instance that can be shared across backends and platforms. The findfont function returns the best TrueType (TTF) font file in the local or system font path that matches the specified FontProperties instance. The FontManager also handles Adobe Font Metrics (AFM) font files for use by the PostScript backend. The design is based on the W3C Cascading Style Sheet, Level 1 (CSS1) font specification. Future versions may implement the Level 2 or 2.1 specifications. classmatplotlib.font_manager.FontManager(size=None, weight='normal')[source]
Bases: object On import, the FontManager singleton instance creates a list of ttf and afm fonts and caches their FontProperties. The FontManager.findfont method does a nearest neighbor search to find the font that most closely matches the specification. If no good enough match is found, the default font is returned. addfont(path)[source]
Cache the properties of the font at path to make it available to the FontManager. The type of font is inferred from the path suffix. Parameters
pathstr or path-like
propertydefaultFont
findfont(prop, fontext='ttf', directory=None, fallback_to_default=True, rebuild_if_missing=True)[source]
Find a font that most closely matches the given font properties. Parameters
propstr or FontProperties
The font properties to search for. This can be either a FontProperties object or a string defining a fontconfig patterns.
fontext{'ttf', 'afm'}, default: 'ttf'
The extension of the font file: 'ttf': TrueType and OpenType fonts (.ttf, .ttc, .otf) 'afm': Adobe Font Metrics (.afm)
directorystr, optional
If given, only search this directory and its subdirectories.
fallback_to_defaultbool
If True, will fallback to the default font family (usually "DejaVu Sans" or "Helvetica") if the first lookup hard-fails.
rebuild_if_missingbool
Whether to rebuild the font cache and search again if the first match appears to point to a nonexisting font (i.e., the font cache contains outdated entries). Returns
str
The filename of the best matching font. Notes This performs a nearest neighbor search. Each font is given a similarity score to the target font properties. The first font with the highest score is returned. If no matches below a certain threshold are found, the default font (usually DejaVu Sans) is returned. The result is cached, so subsequent lookups don't have to perform the O(n) nearest neighbor search. See the W3C Cascading Style Sheet, Level 1 documentation for a description of the font finding algorithm.
staticget_default_size()[source]
Return the default font size.
get_default_weight()[source]
Return the default font weight.
score_family(families, family2)[source]
Return a match score between the list of font families in families and the font family name family2. An exact match at the head of the list returns 0.0. A match further down the list will return between 0 and 1. No match will return 1.0.
score_size(size1, size2)[source]
Return a match score between size1 and size2. If size2 (the size specified in the font file) is 'scalable', this function always returns 0.0, since any font size can be generated. Otherwise, the result is the absolute distance between size1 and size2, normalized so that the usual range of font sizes (6pt - 72pt) will lie between 0.0 and 1.0.
score_stretch(stretch1, stretch2)[source]
Return a match score between stretch1 and stretch2. The result is the absolute value of the difference between the CSS numeric values of stretch1 and stretch2, normalized between 0.0 and 1.0.
score_style(style1, style2)[source]
Return a match score between style1 and style2. An exact match returns 0.0. A match between 'italic' and 'oblique' returns 0.1. No match returns 1.0.
score_variant(variant1, variant2)[source]
Return a match score between variant1 and variant2. An exact match returns 0.0, otherwise 1.0.
score_weight(weight1, weight2)[source]
Return a match score between weight1 and weight2. The result is 0.0 if both weight1 and weight 2 are given as strings and have the same value. Otherwise, the result is the absolute value of the difference between the CSS numeric values of weight1 and weight2, normalized between 0.05 and 1.0.
set_default_weight(weight)[source]
Set the default font weight. The initial value is 'normal'.
classmatplotlib.font_manager.FontProperties(family=None, style=None, variant=None, weight=None, stretch=None, size=None, fname=None, math_fontfamily=None)[source]
Bases: object A class for storing and manipulating font properties. The font properties are the six properties described in the W3C Cascading Style Sheet, Level 1 font specification and math_fontfamily for math fonts: family: A list of font names in decreasing order of priority. The items may include a generic font family name, either 'sans-serif' (default), 'serif', 'cursive', 'fantasy', or 'monospace'. In that case, the actual font to be used will be looked up from the associated rcParam. style: Either 'normal' (default), 'italic' or 'oblique'. variant: Either 'normal' (default) or 'small-caps'. stretch: A numeric value in the range 0-1000 or one of 'ultra-condensed', 'extra-condensed', 'condensed', 'semi-condensed', 'normal' (default), 'semi-expanded', 'expanded', 'extra-expanded' or 'ultra-expanded'. weight: A numeric value in the range 0-1000 or one of 'ultralight', 'light', 'normal' (default), 'regular', 'book', 'medium', 'roman', 'semibold', 'demibold', 'demi', 'bold', 'heavy', 'extra bold', 'black'. size: Either an relative value of 'xx-small', 'x-small', 'small', 'medium', 'large', 'x-large', 'xx-large' or an absolute font size, e.g., 10 (default). math_fontfamily: The family of fonts used to render math text; overrides rcParams["mathtext.fontset"] (default: 'dejavusans'). Supported values are the same as the ones supported by rcParams["mathtext.fontset"] (default: 'dejavusans'): 'dejavusans', 'dejavuserif', 'cm', 'stix', 'stixsans' and 'custom'. Alternatively, a font may be specified using the absolute path to a font file, by using the fname kwarg. However, in this case, it is typically simpler to just pass the path (as a pathlib.Path, not a str) to the font kwarg of the Text object. The preferred usage of font sizes is to use the relative values, e.g., 'large', instead of absolute font sizes, e.g., 12. This approach allows all text sizes to be made larger or smaller based on the font manager's default font size. This class will also accept a fontconfig pattern, if it is the only argument provided. This support does not depend on fontconfig; we are merely borrowing its pattern syntax for use here. Note that Matplotlib's internal font manager and fontconfig use a different algorithm to lookup fonts, so the results of the same pattern may be different in Matplotlib than in other applications that use fontconfig. copy()[source]
Return a copy of self.
get_family()[source]
Return a list of font names that comprise the font family.
get_file()[source]
Return the filename of the associated font.
get_fontconfig_pattern()[source]
Get a fontconfig pattern suitable for looking up the font as specified with fontconfig's fc-match utility. This support does not depend on fontconfig; we are merely borrowing its pattern syntax for use here.
get_math_fontfamily()[source]
Return the name of the font family used for math text. The default font is rcParams["mathtext.fontset"] (default: 'dejavusans').
get_name()[source]
Return the name of the font that best matches the font properties.
get_size()[source]
Return the font size.
get_size_in_points()[source]
get_slant()[source]
Return the font style. Values are: 'normal', 'italic' or 'oblique'.
get_stretch()[source]
Return the font stretch or width. Options are: 'ultra-condensed', 'extra-condensed', 'condensed', 'semi-condensed', 'normal', 'semi-expanded', 'expanded', 'extra-expanded', 'ultra-expanded'.
get_style()[source]
Return the font style. Values are: 'normal', 'italic' or 'oblique'.
get_variant()[source]
Return the font variant. Values are: 'normal' or 'small-caps'.
get_weight()[source]
Set the font weight. Options are: A numeric value in the range 0-1000 or one of 'light', 'normal', 'regular', 'book', 'medium', 'roman', 'semibold', 'demibold', 'demi', 'bold', 'heavy', 'extra bold', 'black'
set_family(family)[source]
Change the font family. May be either an alias (generic name is CSS parlance), such as: 'serif', 'sans-serif', 'cursive', 'fantasy', or 'monospace', a real font name or a list of real font names. Real font names are not supported when rcParams["text.usetex"] (default: False) is True.
set_file(file)[source]
Set the filename of the fontfile to use. In this case, all other properties will be ignored.
set_fontconfig_pattern(pattern)[source]
Set the properties by parsing a fontconfig pattern. This support does not depend on fontconfig; we are merely borrowing its pattern syntax for use here.
set_math_fontfamily(fontfamily)[source]
Set the font family for text in math mode. If not set explicitly, rcParams["mathtext.fontset"] (default: 'dejavusans') will be used. Parameters
fontfamilystr
The name of the font family. Available font families are defined in the matplotlibrc.template file here See also text.Text.get_math_fontfamily
set_name(family)[source]
Change the font family. May be either an alias (generic name is CSS parlance), such as: 'serif', 'sans-serif', 'cursive', 'fantasy', or 'monospace', a real font name or a list of real font names. Real font names are not supported when rcParams["text.usetex"] (default: False) is True.
set_size(size)[source]
Set the font size. Either an relative value of 'xx-small', 'x-small', 'small', 'medium', 'large', 'x-large', 'xx-large' or an absolute font size, e.g., 12.
set_slant(style)[source]
Set the font style. Values are: 'normal', 'italic' or 'oblique'.
set_stretch(stretch)[source]
Set the font stretch or width. Options are: 'ultra-condensed', 'extra-condensed', 'condensed', 'semi-condensed', 'normal', 'semi-expanded', 'expanded', 'extra-expanded' or 'ultra-expanded', or a numeric value in the range 0-1000.
set_style(style)[source]
Set the font style. Values are: 'normal', 'italic' or 'oblique'.
set_variant(variant)[source]
Set the font variant. Values are: 'normal' or 'small-caps'.
set_weight(weight)[source]
Set the font weight. May be either a numeric value in the range 0-1000 or one of 'ultralight', 'light', 'normal', 'regular', 'book', 'medium', 'roman', 'semibold', 'demibold', 'demi', 'bold', 'heavy', 'extra bold', 'black'
matplotlib.font_manager.afmFontProperty(fontpath, font)[source]
Extract information from an AFM font file. Parameters
fontAFM
The AFM font file from which information will be extracted. Returns
FontEntry
The extracted font properties.
matplotlib.font_manager.findSystemFonts(fontpaths=None, fontext='ttf')[source]
Search for fonts in the specified font paths. If no paths are given, will use a standard set of system paths, as well as the list of fonts tracked by fontconfig if fontconfig is installed and available. A list of TrueType fonts are returned by default with AFM fonts as an option.
matplotlib.font_manager.findfont(prop, fontext='ttf', directory=None, fallback_to_default=True, rebuild_if_missing=True)[source]
Find a font that most closely matches the given font properties. Parameters
propstr or FontProperties
The font properties to search for. This can be either a FontProperties object or a string defining a fontconfig patterns.
fontext{'ttf', 'afm'}, default: 'ttf'
The extension of the font file: 'ttf': TrueType and OpenType fonts (.ttf, .ttc, .otf) 'afm': Adobe Font Metrics (.afm)
directorystr, optional
If given, only search this directory and its subdirectories.
fallback_to_defaultbool
If True, will fallback to the default font family (usually "DejaVu Sans" or "Helvetica") if the first lookup hard-fails.
rebuild_if_missingbool
Whether to rebuild the font cache and search again if the first match appears to point to a nonexisting font (i.e., the font cache contains outdated entries). Returns
str
The filename of the best matching font. Notes This performs a nearest neighbor search. Each font is given a similarity score to the target font properties. The first font with the highest score is returned. If no matches below a certain threshold are found, the default font (usually DejaVu Sans) is returned. The result is cached, so subsequent lookups don't have to perform the O(n) nearest neighbor search. See the W3C Cascading Style Sheet, Level 1 documentation for a description of the font finding algorithm.
matplotlib.font_manager.get_font(filename, hinting_factor=None)[source]
matplotlib.font_manager.get_fontconfig_fonts(fontext='ttf')[source]
[Deprecated] List font filenames known to fc-list having the given extension. Notes Deprecated since version 3.5.
matplotlib.font_manager.get_fontext_synonyms(fontext)[source]
Return a list of file extensions extensions that are synonyms for the given file extension fileext.
matplotlib.font_manager.is_opentype_cff_font(filename)[source]
Return whether the given font is a Postscript Compact Font Format Font embedded in an OpenType wrapper. Used by the PostScript and PDF backends that can not subset these fonts.
matplotlib.font_manager.json_dump(data, filename)[source]
Dump FontManager data as JSON to the file named filename. See also json_load
Notes File paths that are children of the Matplotlib data path (typically, fonts shipped with Matplotlib) are stored relative to that data path (to remain valid across virtualenvs). This function temporarily locks the output file to prevent multiple processes from overwriting one another's output.
matplotlib.font_manager.json_load(filename)[source]
Load a FontManager from the JSON file named filename. See also json_dump
matplotlib.font_manager.list_fonts(directory, extensions)[source]
Return a list of all fonts matching any of the extensions, found recursively under the directory.
matplotlib.font_manager.ttfFontProperty(font)[source]
Extract information from a TrueType font file. Parameters
fontFT2Font
The TrueType font file from which information will be extracted. Returns
FontEntry
The extracted font properties.
matplotlib.font_manager.win32FontDirectory()[source]
Return the user-specified font directory for Win32. This is looked up from the registry key \\HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\Shell Folders\Fonts
If the key is not found, %WINDIR%\Fonts will be returned.
matplotlib.font_manager.win32InstalledFonts(directory=None, fontext='ttf')[source]
[Deprecated] Search for fonts in the specified font directory, or use the system directories if none given. Additionally, it is searched for user fonts installed. A list of TrueType font filenames are returned by default, or AFM fonts if fontext == 'afm'. Notes Deprecated since version 3.5.
classmatplotlib.font_manager.FontEntry(fname:str='', name:str='', style:str='normal', variant:str='normal', weight:str='normal', stretch:str='normal', size:str='medium')
A class for storing Font properties. It is used when populating the font lookup dictionary. | matplotlib.font_manager_api |
matplotlib.font_manager.afmFontProperty(fontpath, font)[source]
Extract information from an AFM font file. Parameters
fontAFM
The AFM font file from which information will be extracted. Returns
FontEntry
The extracted font properties. | matplotlib.font_manager_api#matplotlib.font_manager.afmFontProperty |
matplotlib.font_manager.findfont(prop, fontext='ttf', directory=None, fallback_to_default=True, rebuild_if_missing=True)[source]
Find a font that most closely matches the given font properties. Parameters
propstr or FontProperties
The font properties to search for. This can be either a FontProperties object or a string defining a fontconfig patterns.
fontext{'ttf', 'afm'}, default: 'ttf'
The extension of the font file: 'ttf': TrueType and OpenType fonts (.ttf, .ttc, .otf) 'afm': Adobe Font Metrics (.afm)
directorystr, optional
If given, only search this directory and its subdirectories.
fallback_to_defaultbool
If True, will fallback to the default font family (usually "DejaVu Sans" or "Helvetica") if the first lookup hard-fails.
rebuild_if_missingbool
Whether to rebuild the font cache and search again if the first match appears to point to a nonexisting font (i.e., the font cache contains outdated entries). Returns
str
The filename of the best matching font. Notes This performs a nearest neighbor search. Each font is given a similarity score to the target font properties. The first font with the highest score is returned. If no matches below a certain threshold are found, the default font (usually DejaVu Sans) is returned. The result is cached, so subsequent lookups don't have to perform the O(n) nearest neighbor search. See the W3C Cascading Style Sheet, Level 1 documentation for a description of the font finding algorithm. | matplotlib.font_manager_api#matplotlib.font_manager.findfont |
matplotlib.font_manager.findSystemFonts(fontpaths=None, fontext='ttf')[source]
Search for fonts in the specified font paths. If no paths are given, will use a standard set of system paths, as well as the list of fonts tracked by fontconfig if fontconfig is installed and available. A list of TrueType fonts are returned by default with AFM fonts as an option. | matplotlib.font_manager_api#matplotlib.font_manager.findSystemFonts |
classmatplotlib.font_manager.FontEntry(fname:str='', name:str='', style:str='normal', variant:str='normal', weight:str='normal', stretch:str='normal', size:str='medium')
A class for storing Font properties. It is used when populating the font lookup dictionary. | matplotlib.font_manager_api#matplotlib.font_manager.FontEntry |
classmatplotlib.font_manager.FontManager(size=None, weight='normal')[source]
Bases: object On import, the FontManager singleton instance creates a list of ttf and afm fonts and caches their FontProperties. The FontManager.findfont method does a nearest neighbor search to find the font that most closely matches the specification. If no good enough match is found, the default font is returned. addfont(path)[source]
Cache the properties of the font at path to make it available to the FontManager. The type of font is inferred from the path suffix. Parameters
pathstr or path-like
propertydefaultFont
findfont(prop, fontext='ttf', directory=None, fallback_to_default=True, rebuild_if_missing=True)[source]
Find a font that most closely matches the given font properties. Parameters
propstr or FontProperties
The font properties to search for. This can be either a FontProperties object or a string defining a fontconfig patterns.
fontext{'ttf', 'afm'}, default: 'ttf'
The extension of the font file: 'ttf': TrueType and OpenType fonts (.ttf, .ttc, .otf) 'afm': Adobe Font Metrics (.afm)
directorystr, optional
If given, only search this directory and its subdirectories.
fallback_to_defaultbool
If True, will fallback to the default font family (usually "DejaVu Sans" or "Helvetica") if the first lookup hard-fails.
rebuild_if_missingbool
Whether to rebuild the font cache and search again if the first match appears to point to a nonexisting font (i.e., the font cache contains outdated entries). Returns
str
The filename of the best matching font. Notes This performs a nearest neighbor search. Each font is given a similarity score to the target font properties. The first font with the highest score is returned. If no matches below a certain threshold are found, the default font (usually DejaVu Sans) is returned. The result is cached, so subsequent lookups don't have to perform the O(n) nearest neighbor search. See the W3C Cascading Style Sheet, Level 1 documentation for a description of the font finding algorithm.
staticget_default_size()[source]
Return the default font size.
get_default_weight()[source]
Return the default font weight.
score_family(families, family2)[source]
Return a match score between the list of font families in families and the font family name family2. An exact match at the head of the list returns 0.0. A match further down the list will return between 0 and 1. No match will return 1.0.
score_size(size1, size2)[source]
Return a match score between size1 and size2. If size2 (the size specified in the font file) is 'scalable', this function always returns 0.0, since any font size can be generated. Otherwise, the result is the absolute distance between size1 and size2, normalized so that the usual range of font sizes (6pt - 72pt) will lie between 0.0 and 1.0.
score_stretch(stretch1, stretch2)[source]
Return a match score between stretch1 and stretch2. The result is the absolute value of the difference between the CSS numeric values of stretch1 and stretch2, normalized between 0.0 and 1.0.
score_style(style1, style2)[source]
Return a match score between style1 and style2. An exact match returns 0.0. A match between 'italic' and 'oblique' returns 0.1. No match returns 1.0.
score_variant(variant1, variant2)[source]
Return a match score between variant1 and variant2. An exact match returns 0.0, otherwise 1.0.
score_weight(weight1, weight2)[source]
Return a match score between weight1 and weight2. The result is 0.0 if both weight1 and weight 2 are given as strings and have the same value. Otherwise, the result is the absolute value of the difference between the CSS numeric values of weight1 and weight2, normalized between 0.05 and 1.0.
set_default_weight(weight)[source]
Set the default font weight. The initial value is 'normal'. | matplotlib.font_manager_api#matplotlib.font_manager.FontManager |
addfont(path)[source]
Cache the properties of the font at path to make it available to the FontManager. The type of font is inferred from the path suffix. Parameters
pathstr or path-like | matplotlib.font_manager_api#matplotlib.font_manager.FontManager.addfont |
findfont(prop, fontext='ttf', directory=None, fallback_to_default=True, rebuild_if_missing=True)[source]
Find a font that most closely matches the given font properties. Parameters
propstr or FontProperties
The font properties to search for. This can be either a FontProperties object or a string defining a fontconfig patterns.
fontext{'ttf', 'afm'}, default: 'ttf'
The extension of the font file: 'ttf': TrueType and OpenType fonts (.ttf, .ttc, .otf) 'afm': Adobe Font Metrics (.afm)
directorystr, optional
If given, only search this directory and its subdirectories.
fallback_to_defaultbool
If True, will fallback to the default font family (usually "DejaVu Sans" or "Helvetica") if the first lookup hard-fails.
rebuild_if_missingbool
Whether to rebuild the font cache and search again if the first match appears to point to a nonexisting font (i.e., the font cache contains outdated entries). Returns
str
The filename of the best matching font. Notes This performs a nearest neighbor search. Each font is given a similarity score to the target font properties. The first font with the highest score is returned. If no matches below a certain threshold are found, the default font (usually DejaVu Sans) is returned. The result is cached, so subsequent lookups don't have to perform the O(n) nearest neighbor search. See the W3C Cascading Style Sheet, Level 1 documentation for a description of the font finding algorithm. | matplotlib.font_manager_api#matplotlib.font_manager.FontManager.findfont |
staticget_default_size()[source]
Return the default font size. | matplotlib.font_manager_api#matplotlib.font_manager.FontManager.get_default_size |
get_default_weight()[source]
Return the default font weight. | matplotlib.font_manager_api#matplotlib.font_manager.FontManager.get_default_weight |
score_family(families, family2)[source]
Return a match score between the list of font families in families and the font family name family2. An exact match at the head of the list returns 0.0. A match further down the list will return between 0 and 1. No match will return 1.0. | matplotlib.font_manager_api#matplotlib.font_manager.FontManager.score_family |
score_size(size1, size2)[source]
Return a match score between size1 and size2. If size2 (the size specified in the font file) is 'scalable', this function always returns 0.0, since any font size can be generated. Otherwise, the result is the absolute distance between size1 and size2, normalized so that the usual range of font sizes (6pt - 72pt) will lie between 0.0 and 1.0. | matplotlib.font_manager_api#matplotlib.font_manager.FontManager.score_size |
score_stretch(stretch1, stretch2)[source]
Return a match score between stretch1 and stretch2. The result is the absolute value of the difference between the CSS numeric values of stretch1 and stretch2, normalized between 0.0 and 1.0. | matplotlib.font_manager_api#matplotlib.font_manager.FontManager.score_stretch |
score_style(style1, style2)[source]
Return a match score between style1 and style2. An exact match returns 0.0. A match between 'italic' and 'oblique' returns 0.1. No match returns 1.0. | matplotlib.font_manager_api#matplotlib.font_manager.FontManager.score_style |
score_variant(variant1, variant2)[source]
Return a match score between variant1 and variant2. An exact match returns 0.0, otherwise 1.0. | matplotlib.font_manager_api#matplotlib.font_manager.FontManager.score_variant |
score_weight(weight1, weight2)[source]
Return a match score between weight1 and weight2. The result is 0.0 if both weight1 and weight 2 are given as strings and have the same value. Otherwise, the result is the absolute value of the difference between the CSS numeric values of weight1 and weight2, normalized between 0.05 and 1.0. | matplotlib.font_manager_api#matplotlib.font_manager.FontManager.score_weight |
set_default_weight(weight)[source]
Set the default font weight. The initial value is 'normal'. | matplotlib.font_manager_api#matplotlib.font_manager.FontManager.set_default_weight |
classmatplotlib.font_manager.FontProperties(family=None, style=None, variant=None, weight=None, stretch=None, size=None, fname=None, math_fontfamily=None)[source]
Bases: object A class for storing and manipulating font properties. The font properties are the six properties described in the W3C Cascading Style Sheet, Level 1 font specification and math_fontfamily for math fonts: family: A list of font names in decreasing order of priority. The items may include a generic font family name, either 'sans-serif' (default), 'serif', 'cursive', 'fantasy', or 'monospace'. In that case, the actual font to be used will be looked up from the associated rcParam. style: Either 'normal' (default), 'italic' or 'oblique'. variant: Either 'normal' (default) or 'small-caps'. stretch: A numeric value in the range 0-1000 or one of 'ultra-condensed', 'extra-condensed', 'condensed', 'semi-condensed', 'normal' (default), 'semi-expanded', 'expanded', 'extra-expanded' or 'ultra-expanded'. weight: A numeric value in the range 0-1000 or one of 'ultralight', 'light', 'normal' (default), 'regular', 'book', 'medium', 'roman', 'semibold', 'demibold', 'demi', 'bold', 'heavy', 'extra bold', 'black'. size: Either an relative value of 'xx-small', 'x-small', 'small', 'medium', 'large', 'x-large', 'xx-large' or an absolute font size, e.g., 10 (default). math_fontfamily: The family of fonts used to render math text; overrides rcParams["mathtext.fontset"] (default: 'dejavusans'). Supported values are the same as the ones supported by rcParams["mathtext.fontset"] (default: 'dejavusans'): 'dejavusans', 'dejavuserif', 'cm', 'stix', 'stixsans' and 'custom'. Alternatively, a font may be specified using the absolute path to a font file, by using the fname kwarg. However, in this case, it is typically simpler to just pass the path (as a pathlib.Path, not a str) to the font kwarg of the Text object. The preferred usage of font sizes is to use the relative values, e.g., 'large', instead of absolute font sizes, e.g., 12. This approach allows all text sizes to be made larger or smaller based on the font manager's default font size. This class will also accept a fontconfig pattern, if it is the only argument provided. This support does not depend on fontconfig; we are merely borrowing its pattern syntax for use here. Note that Matplotlib's internal font manager and fontconfig use a different algorithm to lookup fonts, so the results of the same pattern may be different in Matplotlib than in other applications that use fontconfig. copy()[source]
Return a copy of self.
get_family()[source]
Return a list of font names that comprise the font family.
get_file()[source]
Return the filename of the associated font.
get_fontconfig_pattern()[source]
Get a fontconfig pattern suitable for looking up the font as specified with fontconfig's fc-match utility. This support does not depend on fontconfig; we are merely borrowing its pattern syntax for use here.
get_math_fontfamily()[source]
Return the name of the font family used for math text. The default font is rcParams["mathtext.fontset"] (default: 'dejavusans').
get_name()[source]
Return the name of the font that best matches the font properties.
get_size()[source]
Return the font size.
get_size_in_points()[source]
get_slant()[source]
Return the font style. Values are: 'normal', 'italic' or 'oblique'.
get_stretch()[source]
Return the font stretch or width. Options are: 'ultra-condensed', 'extra-condensed', 'condensed', 'semi-condensed', 'normal', 'semi-expanded', 'expanded', 'extra-expanded', 'ultra-expanded'.
get_style()[source]
Return the font style. Values are: 'normal', 'italic' or 'oblique'.
get_variant()[source]
Return the font variant. Values are: 'normal' or 'small-caps'.
get_weight()[source]
Set the font weight. Options are: A numeric value in the range 0-1000 or one of 'light', 'normal', 'regular', 'book', 'medium', 'roman', 'semibold', 'demibold', 'demi', 'bold', 'heavy', 'extra bold', 'black'
set_family(family)[source]
Change the font family. May be either an alias (generic name is CSS parlance), such as: 'serif', 'sans-serif', 'cursive', 'fantasy', or 'monospace', a real font name or a list of real font names. Real font names are not supported when rcParams["text.usetex"] (default: False) is True.
set_file(file)[source]
Set the filename of the fontfile to use. In this case, all other properties will be ignored.
set_fontconfig_pattern(pattern)[source]
Set the properties by parsing a fontconfig pattern. This support does not depend on fontconfig; we are merely borrowing its pattern syntax for use here.
set_math_fontfamily(fontfamily)[source]
Set the font family for text in math mode. If not set explicitly, rcParams["mathtext.fontset"] (default: 'dejavusans') will be used. Parameters
fontfamilystr
The name of the font family. Available font families are defined in the matplotlibrc.template file here See also text.Text.get_math_fontfamily
set_name(family)[source]
Change the font family. May be either an alias (generic name is CSS parlance), such as: 'serif', 'sans-serif', 'cursive', 'fantasy', or 'monospace', a real font name or a list of real font names. Real font names are not supported when rcParams["text.usetex"] (default: False) is True.
set_size(size)[source]
Set the font size. Either an relative value of 'xx-small', 'x-small', 'small', 'medium', 'large', 'x-large', 'xx-large' or an absolute font size, e.g., 12.
set_slant(style)[source]
Set the font style. Values are: 'normal', 'italic' or 'oblique'.
set_stretch(stretch)[source]
Set the font stretch or width. Options are: 'ultra-condensed', 'extra-condensed', 'condensed', 'semi-condensed', 'normal', 'semi-expanded', 'expanded', 'extra-expanded' or 'ultra-expanded', or a numeric value in the range 0-1000.
set_style(style)[source]
Set the font style. Values are: 'normal', 'italic' or 'oblique'.
set_variant(variant)[source]
Set the font variant. Values are: 'normal' or 'small-caps'.
set_weight(weight)[source]
Set the font weight. May be either a numeric value in the range 0-1000 or one of 'ultralight', 'light', 'normal', 'regular', 'book', 'medium', 'roman', 'semibold', 'demibold', 'demi', 'bold', 'heavy', 'extra bold', 'black' | matplotlib.font_manager_api#matplotlib.font_manager.FontProperties |
copy()[source]
Return a copy of self. | matplotlib.font_manager_api#matplotlib.font_manager.FontProperties.copy |
get_family()[source]
Return a list of font names that comprise the font family. | matplotlib.font_manager_api#matplotlib.font_manager.FontProperties.get_family |
get_file()[source]
Return the filename of the associated font. | matplotlib.font_manager_api#matplotlib.font_manager.FontProperties.get_file |
get_fontconfig_pattern()[source]
Get a fontconfig pattern suitable for looking up the font as specified with fontconfig's fc-match utility. This support does not depend on fontconfig; we are merely borrowing its pattern syntax for use here. | matplotlib.font_manager_api#matplotlib.font_manager.FontProperties.get_fontconfig_pattern |
get_math_fontfamily()[source]
Return the name of the font family used for math text. The default font is rcParams["mathtext.fontset"] (default: 'dejavusans'). | matplotlib.font_manager_api#matplotlib.font_manager.FontProperties.get_math_fontfamily |
get_name()[source]
Return the name of the font that best matches the font properties. | matplotlib.font_manager_api#matplotlib.font_manager.FontProperties.get_name |
get_size()[source]
Return the font size. | matplotlib.font_manager_api#matplotlib.font_manager.FontProperties.get_size |
get_size_in_points()[source] | matplotlib.font_manager_api#matplotlib.font_manager.FontProperties.get_size_in_points |
get_slant()[source]
Return the font style. Values are: 'normal', 'italic' or 'oblique'. | matplotlib.font_manager_api#matplotlib.font_manager.FontProperties.get_slant |
get_stretch()[source]
Return the font stretch or width. Options are: 'ultra-condensed', 'extra-condensed', 'condensed', 'semi-condensed', 'normal', 'semi-expanded', 'expanded', 'extra-expanded', 'ultra-expanded'. | matplotlib.font_manager_api#matplotlib.font_manager.FontProperties.get_stretch |
get_style()[source]
Return the font style. Values are: 'normal', 'italic' or 'oblique'. | matplotlib.font_manager_api#matplotlib.font_manager.FontProperties.get_style |
get_variant()[source]
Return the font variant. Values are: 'normal' or 'small-caps'. | matplotlib.font_manager_api#matplotlib.font_manager.FontProperties.get_variant |
get_weight()[source]
Set the font weight. Options are: A numeric value in the range 0-1000 or one of 'light', 'normal', 'regular', 'book', 'medium', 'roman', 'semibold', 'demibold', 'demi', 'bold', 'heavy', 'extra bold', 'black' | matplotlib.font_manager_api#matplotlib.font_manager.FontProperties.get_weight |
set_family(family)[source]
Change the font family. May be either an alias (generic name is CSS parlance), such as: 'serif', 'sans-serif', 'cursive', 'fantasy', or 'monospace', a real font name or a list of real font names. Real font names are not supported when rcParams["text.usetex"] (default: False) is True. | matplotlib.font_manager_api#matplotlib.font_manager.FontProperties.set_family |
set_file(file)[source]
Set the filename of the fontfile to use. In this case, all other properties will be ignored. | matplotlib.font_manager_api#matplotlib.font_manager.FontProperties.set_file |
set_fontconfig_pattern(pattern)[source]
Set the properties by parsing a fontconfig pattern. This support does not depend on fontconfig; we are merely borrowing its pattern syntax for use here. | matplotlib.font_manager_api#matplotlib.font_manager.FontProperties.set_fontconfig_pattern |
set_math_fontfamily(fontfamily)[source]
Set the font family for text in math mode. If not set explicitly, rcParams["mathtext.fontset"] (default: 'dejavusans') will be used. Parameters
fontfamilystr
The name of the font family. Available font families are defined in the matplotlibrc.template file here See also text.Text.get_math_fontfamily | matplotlib.font_manager_api#matplotlib.font_manager.FontProperties.set_math_fontfamily |
set_name(family)[source]
Change the font family. May be either an alias (generic name is CSS parlance), such as: 'serif', 'sans-serif', 'cursive', 'fantasy', or 'monospace', a real font name or a list of real font names. Real font names are not supported when rcParams["text.usetex"] (default: False) is True. | matplotlib.font_manager_api#matplotlib.font_manager.FontProperties.set_name |
set_size(size)[source]
Set the font size. Either an relative value of 'xx-small', 'x-small', 'small', 'medium', 'large', 'x-large', 'xx-large' or an absolute font size, e.g., 12. | matplotlib.font_manager_api#matplotlib.font_manager.FontProperties.set_size |
set_slant(style)[source]
Set the font style. Values are: 'normal', 'italic' or 'oblique'. | matplotlib.font_manager_api#matplotlib.font_manager.FontProperties.set_slant |
set_stretch(stretch)[source]
Set the font stretch or width. Options are: 'ultra-condensed', 'extra-condensed', 'condensed', 'semi-condensed', 'normal', 'semi-expanded', 'expanded', 'extra-expanded' or 'ultra-expanded', or a numeric value in the range 0-1000. | matplotlib.font_manager_api#matplotlib.font_manager.FontProperties.set_stretch |
set_style(style)[source]
Set the font style. Values are: 'normal', 'italic' or 'oblique'. | matplotlib.font_manager_api#matplotlib.font_manager.FontProperties.set_style |
set_variant(variant)[source]
Set the font variant. Values are: 'normal' or 'small-caps'. | matplotlib.font_manager_api#matplotlib.font_manager.FontProperties.set_variant |
set_weight(weight)[source]
Set the font weight. May be either a numeric value in the range 0-1000 or one of 'ultralight', 'light', 'normal', 'regular', 'book', 'medium', 'roman', 'semibold', 'demibold', 'demi', 'bold', 'heavy', 'extra bold', 'black' | matplotlib.font_manager_api#matplotlib.font_manager.FontProperties.set_weight |
matplotlib.font_manager.get_font(filename, hinting_factor=None)[source] | matplotlib.font_manager_api#matplotlib.font_manager.get_font |
matplotlib.font_manager.get_fontconfig_fonts(fontext='ttf')[source]
[Deprecated] List font filenames known to fc-list having the given extension. Notes Deprecated since version 3.5. | matplotlib.font_manager_api#matplotlib.font_manager.get_fontconfig_fonts |
matplotlib.font_manager.get_fontext_synonyms(fontext)[source]
Return a list of file extensions extensions that are synonyms for the given file extension fileext. | matplotlib.font_manager_api#matplotlib.font_manager.get_fontext_synonyms |
matplotlib.font_manager.is_opentype_cff_font(filename)[source]
Return whether the given font is a Postscript Compact Font Format Font embedded in an OpenType wrapper. Used by the PostScript and PDF backends that can not subset these fonts. | matplotlib.font_manager_api#matplotlib.font_manager.is_opentype_cff_font |
matplotlib.font_manager.json_dump(data, filename)[source]
Dump FontManager data as JSON to the file named filename. See also json_load
Notes File paths that are children of the Matplotlib data path (typically, fonts shipped with Matplotlib) are stored relative to that data path (to remain valid across virtualenvs). This function temporarily locks the output file to prevent multiple processes from overwriting one another's output. | matplotlib.font_manager_api#matplotlib.font_manager.json_dump |
matplotlib.font_manager.json_load(filename)[source]
Load a FontManager from the JSON file named filename. See also json_dump | matplotlib.font_manager_api#matplotlib.font_manager.json_load |
matplotlib.font_manager.list_fonts(directory, extensions)[source]
Return a list of all fonts matching any of the extensions, found recursively under the directory. | matplotlib.font_manager_api#matplotlib.font_manager.list_fonts |
matplotlib.font_manager.ttfFontProperty(font)[source]
Extract information from a TrueType font file. Parameters
fontFT2Font
The TrueType font file from which information will be extracted. Returns
FontEntry
The extracted font properties. | matplotlib.font_manager_api#matplotlib.font_manager.ttfFontProperty |
matplotlib.font_manager.win32FontDirectory()[source]
Return the user-specified font directory for Win32. This is looked up from the registry key \\HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\Shell Folders\Fonts
If the key is not found, %WINDIR%\Fonts will be returned. | matplotlib.font_manager_api#matplotlib.font_manager.win32FontDirectory |
matplotlib.font_manager.win32InstalledFonts(directory=None, fontext='ttf')[source]
[Deprecated] Search for fonts in the specified font directory, or use the system directories if none given. Additionally, it is searched for user fonts installed. A list of TrueType font filenames are returned by default, or AFM fonts if fontext == 'afm'. Notes Deprecated since version 3.5. | matplotlib.font_manager_api#matplotlib.font_manager.win32InstalledFonts |
matplotlib.fontconfig_pattern A module for parsing and generating fontconfig patterns. classmatplotlib.fontconfig_pattern.FontconfigPatternParser[source]
Bases: object A simple pyparsing-based parser for fontconfig patterns. parse(pattern)[source]
Parse the given fontconfig pattern and return a dictionary of key/value pairs useful for initializing a font_manager.FontProperties object.
matplotlib.fontconfig_pattern.family_escape(/, repl, string, count=0)
Return the string obtained by replacing the leftmost non-overlapping occurrences of pattern in string by the replacement repl.
matplotlib.fontconfig_pattern.family_unescape(/, repl, string, count=0)
Return the string obtained by replacing the leftmost non-overlapping occurrences of pattern in string by the replacement repl.
matplotlib.fontconfig_pattern.generate_fontconfig_pattern(d)[source]
Given a dictionary of key/value pairs, generates a fontconfig pattern string.
matplotlib.fontconfig_pattern.parse_fontconfig_pattern(pattern)[source]
Parse the given fontconfig pattern and return a dictionary of key/value pairs useful for initializing a font_manager.FontProperties object.
matplotlib.fontconfig_pattern.value_escape(/, repl, string, count=0)
Return the string obtained by replacing the leftmost non-overlapping occurrences of pattern in string by the replacement repl.
matplotlib.fontconfig_pattern.value_unescape(/, repl, string, count=0)
Return the string obtained by replacing the leftmost non-overlapping occurrences of pattern in string by the replacement repl. | matplotlib.fontconfig_pattern_api |
matplotlib.fontconfig_pattern.family_escape(/, repl, string, count=0)
Return the string obtained by replacing the leftmost non-overlapping occurrences of pattern in string by the replacement repl. | matplotlib.fontconfig_pattern_api#matplotlib.fontconfig_pattern.family_escape |
matplotlib.fontconfig_pattern.family_unescape(/, repl, string, count=0)
Return the string obtained by replacing the leftmost non-overlapping occurrences of pattern in string by the replacement repl. | matplotlib.fontconfig_pattern_api#matplotlib.fontconfig_pattern.family_unescape |
classmatplotlib.fontconfig_pattern.FontconfigPatternParser[source]
Bases: object A simple pyparsing-based parser for fontconfig patterns. parse(pattern)[source]
Parse the given fontconfig pattern and return a dictionary of key/value pairs useful for initializing a font_manager.FontProperties object. | matplotlib.fontconfig_pattern_api#matplotlib.fontconfig_pattern.FontconfigPatternParser |
parse(pattern)[source]
Parse the given fontconfig pattern and return a dictionary of key/value pairs useful for initializing a font_manager.FontProperties object. | matplotlib.fontconfig_pattern_api#matplotlib.fontconfig_pattern.FontconfigPatternParser.parse |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.