PlotAxes
- class PlotAxes(*args, **kwargs)[source]
Bases:
AxesThe second lowest-level
Axessubclass used by ultraplot. Implements all plotting overrides.- Parameters:
*args – Passed to
matplotlib.axes.Axes.title (
stror sequence, optional) – The axes title. Can optionally be a sequence strings, in which case the title will be selected from the sequence according tonumber.abc (
boolorstror sequence, default:rc.abc=False) – The “a-b-c” subplot label style. Must contain the characteraorA, for example'a.', or'A'. IfTruethen the default style of'a'is used. TheaorAis replaced with the alphabetic character matching thenumber. Ifnumberis greater than 26, the characters loop around to a, …, z, aa, …, zz, aaa, …, zzz, etc. Can also be a sequence of strings, in which case the “a-b-c” label will be selected sequentially from the list. For exampleaxs.format(abc = ["X", "Y"])for a two-panel figure, andaxes[3:5].format(abc = ["X", "Y"])for a two-panel subset of a larger figure.abcloc, titleloc (
str, default:rc['abc.loc']='left',rc['title.loc']='center') – Strings indicating the location for the a-b-c label and main title. The following locations are valid:Location
Valid keys
center above axes
'center','c'left above axes
'left','l'right above axes
'right','r'lower center inside axes
'lower center','lc'upper center inside axes
'upper center','uc'upper right inside axes
'upper right','ur'upper left inside axes
'upper left','ul'lower left inside axes
'lower left','ll'lower right inside axes
'lower right','lr'left of y axis
'outer left','ol'right of y axis
'outer right','or'abcborder, titleborder (
bool, default:rc['abc.border']=Trueandrc['title.border']=True) – Whether to draw a white border around titles and a-b-c labels positioned inside the axes. This can help them stand out on top of artists plotted inside the axes.abcbbox, titlebbox (
bool, default:rc['abc.bbox']=Falseandrc['title.bbox']=False) – Whether to draw a white bbox around titles and a-b-c labels positioned inside the axes. This can help them stand out on top of artists plotted inside the axes.abcpad (
floatorunit-spec, default:rc['abc.pad']) – Horizontal offset to shift the a-b-c label position. Positive values move the label right, negative values move it left. This is separate fromabctitlepad, which controls spacing between abc and title when co-located. If float, units are points. If string, interpreted byunits.abc_kw, title_kw (dict-like, optional) – Additional settings used to update the a-b-c label and title with
text.update().titlepad (
float, default:rc['title.pad']=5.0) – The padding for the inner and outer titles and a-b-c labels. If float, units are points. If string, interpreted byunits.titleabove (
bool, default:rc['title.above']=True) – Whether to try to put outer titles and a-b-c labels above panels, colorbars, or legends that are above the axes.abctitlepad (
float, default:rc['abc.titlepad']=4.0) – The horizontal padding between a-b-c labels and titles in the same location. If float, units are points. If string, interpreted byunits.ltitle, ctitle, rtitle, ultitle, uctitle, urtitle, lltitle, lctitle, lrtitle (
stror sequence, :py:class:`optional `) – Shorthands for the below keywords. lefttitle, centertitle, righttitle, upperlefttitle, uppercentertitle, upperrighttitle : str or sequence, optionallowerlefttitle, lowercentertitle, lowerrighttitle (
stror sequence, optional) – Additional titles in specific positions (seetitlefor details). This works as an alternative to theax.format(title='Title', titleloc=loc)workflow and permits adding more than one title-like label for a single axes.a, alpha, fc, facecolor, ec, edgecolor, lw, linewidth, ls, linestyle (**default* *) –
rc['axes.alpha']=None(default: 1.0),rc['axes.facecolor']='white'(default: white),rc['axes.edgecolor']='black'(default: black),rc['axes.linewidth']=0.6(default: 0.6), - Additional settings applied to the background patch, and their shorthands. Their defaults values are the'axes'properties.
- Other Parameters:
rc_mode (
int, optional) – The context mode passed tocontext.rc_kw (dict-like, optional) – An alternative to passing extra keyword arguments. See below.
**kwargs – Remaining keyword arguments are passed to
matplotlib.axes.Axes.n Keyword arguments that match the name of anrcsetting are passed toultraplot.config.Configurator.contextand used to update the axes. If the setting name has “dots” you can simply omit the dots. For example,abc='A.'modifies therc.abcsetting,titleloc='left'modifies therc['title.loc']setting,gridminor=Truemodifies therc.gridminorsetting, andgridbelow=Truemodifies therc['grid.below']setting. Many of the keyword arguments documented above are internally applied by retrieving settings passed tocontext.
See also
Axes.format,matplotlib.axes.Axes,ultraplot.axes.PlotAxes,ultraplot.axes.CartesianAxes,ultraplot.axes.PolarAxes,ultraplot.axes.GeoAxes,ultraplot.figure.Figure.subplot,ultraplot.figure.Figure.add_subplotMethods Summary
area(*args, **kwargs)Plot individual, grouped, or overlaid shading patches.
areax(*args, **kwargs)Plot individual, grouped, or overlaid shading patches.
bar(**kwargs)Plot individual, grouped, or stacked bars.
barbs(**kwargs)Plot wind barbs.
barh(**kwargs)Plot individual, grouped, or stacked bars.
beeswarm(*args, **kwargs)Beeswarm plot with SHAP-style feature value coloring.
box(*args, **kwargs)Plot vertical boxes and whiskers with a nice default style.
boxes(*[, new_obj, message])boxh(*args, **kwargs)Plot horizontal boxes and whiskers with a nice default style.
boxplot(**kwargs)Plot vertical boxes and whiskers with a nice default style.
boxploth(*args, **kwargs)Plot horizontal boxes and whiskers with a nice default style.
contour(**kwargs)Plot contour lines.
contourf(**kwargs)Plot filled contours.
curved_quiver(x, y, u, v[, linewidth, ...])Draws curved vector field arrows (streamlines with arrows) for 2D vector fields.
fill_between(**kwargs)Plot individual, grouped, or overlaid shading patches.
fill_betweenx(**kwargs)Plot individual, grouped, or overlaid shading patches.
graph(g[, layout, nodes, edges, labels, ...])Plot a networkx graph with flexible node, edge, and label options.
heatmap(*args[, aspect])Plot grid boxes with formatting suitable for heatmaps.
hexbin(**kwargs)Plot a 2D hexagonally binned histogram.
hist(**kwargs)Plot vertical histograms.
hist2d(**kwargs)Plot a standard 2D histogram.
histh(*args, **kwargs)Plot horizontal histograms.
hlines(*args, **kwargs)Plot horizontal lines.
imshow(**kwargs)Plot an image.
line(*args, **kwargs)Plot standard lines.
linex(*args, **kwargs)Plot standard lines.
loglog(*args, **kwargs)Plot loglog
lollipop(*args, **kwargs)Plot individual or group lollipop graphs.
lollipoph(*args, **kwargs)Plot individual or group lollipop graphs.
matshow(**kwargs)Plot a matrix.
parametric(x, y, c, *[, interp, scalex, scaley])Plot a parametric line.
pcolor(**kwargs)Plot irregular grid boxes.
pcolorfast(**kwargs)Plot grid boxes quickly.
pcolormesh(**kwargs)Plot regular grid boxes.
pie(**kwargs)Plot a pie chart.
plot(**kwargs)Plot standard lines.
plotx(*args, **kwargs)Plot standard lines.
quiver(**kwargs)Plot quiver arrows.
ridgeline(data, **kwargs)Create a vertical ridgeline plot (also known as a joyplot).
ridgelineh(data, **kwargs)Create a horizontal ridgeline plot (also known as a joyplot).
scatter(**kwargs)Plot markers with flexible keyword arguments.
scatterx(*args, **kwargs)Plot markers with flexible keyword arguments.
semilogx(*args, **kwargs)Plot semilogx
semilogy(*args, **kwargs)Plot semilogy
set(*[, adjustable, agg_filter, alpha, ...])Set multiple properties at once.
spy(**kwargs)Plot a sparcity pattern.
stem(**kwargs)Plot stem lines.
stemx(*args, **kwargs)Plot stem lines.
step(**kwargs)Plot step lines.
stepx(*args, **kwargs)Plot step lines.
stream(*args, **kwargs)Plot streamlines.
streamplot(**kwargs)Plot streamlines.
tricontour(**kwargs)Plot contour lines on a triangular grid.
tricontourf(**kwargs)Plot filled contours on a triangular grid.
tripcolor(**kwargs)Plot triangular grid boxes.
violin(*args, **kwargs)Plot vertical violins with a nice default style matching this matplotlib example.
violinh(*args, **kwargs)Plot horizontal violins with a nice default style matching this matplotlib example.
violinplot(**kwargs)Plot vertical violins with a nice default style matching this matplotlib example.
violinploth(*args, **kwargs)Plot horizontal violins with a nice default style matching this matplotlib example.
violins(*[, new_obj, message])vlines(*args, **kwargs)Plot vertical lines.
Methods Documentation
- area(*args, **kwargs)[source]
Plot individual, grouped, or overlaid shading patches.
- Parameters:
*args (
y2orx,y2, orx,y1,y2) – The data passed as positional or keyword arguments. Interpreted as follows:If only
ycoordinates are passed, try to infer thexcoordinates from theSeriesorDataFrameindices or theDataArraycoordinates. Otherwise, thexcoordinates arenp.arange(0, y2.shape[0]).If only
xandy2coordinates are passed, set they1coordinates to zero. This draws elements originating from the zero line.If both
y1andy2are provided, draw elements between these points. If either are 2D, draw elements by iterating over each column.If any arguments are
pint.Quantity, auto-add the pint unit registry to matplotlib’s unit registry usingsetup_matplotlib. Apint.Quantityembedded in anxarray.DataArrayis also supported.
stack, stacked (
bool, default:False) – Whether to “stack” area patches from successive columns of y data or plot area patches on top of each other.data (dict-like, optional) – A dict-like dataset container (e.g.,
DataFrameorDataset). If passed, each data argument can optionally be a stringkeyand the arrays used for plotting are retrieved withdata[key]. This is a native matplotlib feature.autoformat (
bool, default:rc.autoformat=True) – Whether thexaxis labels,yaxis labels, axis formatters, axes titles, legend titles, and colorbar labels are automatically configured when aSeries,DataFrame,DataArray, orQuantityis passed to the plotting command. Formatting ofpint.Quantityunit strings is controlled byrc.unitformat='L'.
- Other Parameters:
where (
ndarray, optional) – A boolean mask for the points that should be shaded. See this matplotlib example.cycle (
cycle-spec, optional) – The cycle specifer, passed to theCycleconstructor. If the returned cycler is unchanged from the current cycler, the axes cycler will not be reset to its first position. To disable property cycling and just use black for the default color, usecycle=False,cycle='none', orcycle=()(analogous to disabling ticks with e.g.xformatter='none'). To restore the default property cycler, usecycle=True.lw, linewidth, linewidths (
unit-spec, default:rc['patch.linewidth']=0.6) – The edge width of the patch(es). If float, units are points. If string, interpreted byunits.ls, linestyle, linestyles (
str, default:'-') – The edge style of the patch(es).ec, edgecolor, edgecolors (
color-spec, default:'none') – The edge color of the patch(es).fc, facecolor, facecolors, fillcolor, fillcolors (
color-spec, optional) – The face color of the patch(es). The propertycycleis used by default.a, alpha, alphas (
float, optional) – The opacity of the patch(es). Inferred fromfacecolorandedgecolorby default.negpos (
bool, default:False) – Whether to shade patches wherey2 >= y1withposcolorand wherey2 < y1withnegcolor. IfTruethis function will return a length-2 silent list of handles.negcolor, poscolor (
color-spec, default:rc.negcolor='blue7',rc.poscolor='red7') – Colors to use for the negative and positive patches. Ignored ifnegposisFalse.edgefix (
boolorfloat, default:rc.edgefix=True) – Whether to fix the common issue where white lines appear between adjacent patches in saved vector graphics (this can slow down figure rendering). See this github repo for a demonstration of the problem. IfTrue, a small default linewidth of0.3is used to cover up the white lines. If float (e.g.edgefix=0.5), this specific linewidth is used to cover up the white lines. This feature is automatically disabled when the patches have transparency.inbounds (
bool, default:rc['axes.inbounds']=True) – Whether to restrict the defaulty(x) axis limits to account for only in-bounds data when thex(y) axis limits have been locked. See alsorc['axes.inbounds']andrc['cmap.inbounds'].label, value (
floatorstr, optional) – The single legend label or colorbar coordinate to be used for this plotted element. Can be numeric or string. This is generally used with 1D positional arguments.labels, values (sequence of
floator sequence ofstr, optional) – The legend labels or colorbar coordinates used for each plotted element. Can be numeric or string, and must match the number of plotted elements. This is generally used with 2D positional arguments.colorbar (
bool,int, orstr, optional) – If notNone, this is a location specifying where to draw an inset or outer colorbar from the resulting object(s). IfTrue, the defaultrc['colorbar.loc']='right'is used. If the same location is used in successive plotting calls, object(s) will be added to the existing colorbar in that location (valid for colorbars built from lists of artists). Valid locations are shown in incolorbar.colorbar_kw (dict-like, optional) – Extra keyword args for the call to
colorbar.legend (
bool,int, orstr, optional) – Location specifying where to draw an inset or outer legend from the resulting object(s). IfTrue, the defaultrc['legend.loc']='best'is used. If the same location is used in successive plotting calls, object(s) will be added to existing legend in that location. Valid locations are shown inlegend().legend_kw (dict-like, optional) – Extra keyword args for the call to
legend.**kwargs – Passed to
fill_between.
- areax(*args, **kwargs)[source]
Plot individual, grouped, or overlaid shading patches.
- Parameters:
*args (
x2ory,x2, ory,x1,x2) – The data passed as positional or keyword arguments. Interpreted as follows:If only
xcoordinates are passed, try to infer theycoordinates from theSeriesorDataFrameindices or theDataArraycoordinates. Otherwise, theycoordinates arenp.arange(0, x2.shape[0]).If only
yandx2coordinates are passed, set thex1coordinates to zero. This draws elements originating from the zero line.If both
x1andx2are provided, draw elements between these points. If either are 2D, draw elements by iterating over each column.If any arguments are
pint.Quantity, auto-add the pint unit registry to matplotlib’s unit registry usingsetup_matplotlib. Apint.Quantityembedded in anxarray.DataArrayis also supported.
stack, stacked (
bool, default:False) – Whether to “stack” area patches from successive columns of x data or plot area patches on top of each other.data (dict-like, optional) – A dict-like dataset container (e.g.,
DataFrameorDataset). If passed, each data argument can optionally be a stringkeyand the arrays used for plotting are retrieved withdata[key]. This is a native matplotlib feature.autoformat (
bool, default:rc.autoformat=True) – Whether thexaxis labels,yaxis labels, axis formatters, axes titles, legend titles, and colorbar labels are automatically configured when aSeries,DataFrame,DataArray, orQuantityis passed to the plotting command. Formatting ofpint.Quantityunit strings is controlled byrc.unitformat='L'.
- Other Parameters:
where (
ndarray, optional) – A boolean mask for the points that should be shaded. See this matplotlib example.cycle (
cycle-spec, optional) – The cycle specifer, passed to theCycleconstructor. If the returned cycler is unchanged from the current cycler, the axes cycler will not be reset to its first position. To disable property cycling and just use black for the default color, usecycle=False,cycle='none', orcycle=()(analogous to disabling ticks with e.g.xformatter='none'). To restore the default property cycler, usecycle=True.lw, linewidth, linewidths (
unit-spec, default:rc['patch.linewidth']=0.6) – The edge width of the patch(es). If float, units are points. If string, interpreted byunits.ls, linestyle, linestyles (
str, default:'-') – The edge style of the patch(es).ec, edgecolor, edgecolors (
color-spec, default:'none') – The edge color of the patch(es).fc, facecolor, facecolors, fillcolor, fillcolors (
color-spec, optional) – The face color of the patch(es). The propertycycleis used by default.a, alpha, alphas (
float, optional) – The opacity of the patch(es). Inferred fromfacecolorandedgecolorby default.negpos (
bool, default:False) – Whether to shade patches wherey2 >= y1withposcolorand wherey2 < y1withnegcolor. IfTruethis function will return a length-2 silent list of handles.negcolor, poscolor (
color-spec, default:rc.negcolor='blue7',rc.poscolor='red7') – Colors to use for the negative and positive patches. Ignored ifnegposisFalse.edgefix (
boolorfloat, default:rc.edgefix=True) – Whether to fix the common issue where white lines appear between adjacent patches in saved vector graphics (this can slow down figure rendering). See this github repo for a demonstration of the problem. IfTrue, a small default linewidth of0.3is used to cover up the white lines. If float (e.g.edgefix=0.5), this specific linewidth is used to cover up the white lines. This feature is automatically disabled when the patches have transparency.inbounds (
bool, default:rc['axes.inbounds']=True) – Whether to restrict the defaulty(x) axis limits to account for only in-bounds data when thex(y) axis limits have been locked. See alsorc['axes.inbounds']andrc['cmap.inbounds'].label, value (
floatorstr, optional) – The single legend label or colorbar coordinate to be used for this plotted element. Can be numeric or string. This is generally used with 1D positional arguments.labels, values (sequence of
floator sequence ofstr, optional) – The legend labels or colorbar coordinates used for each plotted element. Can be numeric or string, and must match the number of plotted elements. This is generally used with 2D positional arguments.colorbar (
bool,int, orstr, optional) – If notNone, this is a location specifying where to draw an inset or outer colorbar from the resulting object(s). IfTrue, the defaultrc['colorbar.loc']='right'is used. If the same location is used in successive plotting calls, object(s) will be added to the existing colorbar in that location (valid for colorbars built from lists of artists). Valid locations are shown in incolorbar.colorbar_kw (dict-like, optional) – Extra keyword args for the call to
colorbar.legend (
bool,int, orstr, optional) – Location specifying where to draw an inset or outer legend from the resulting object(s). IfTrue, the defaultrc['legend.loc']='best'is used. If the same location is used in successive plotting calls, object(s) will be added to existing legend in that location. Valid locations are shown inlegend().legend_kw (dict-like, optional) – Extra keyword args for the call to
legend.**kwargs – Passed to
fill_betweenx.
- bar(**kwargs)[source]
Plot individual, grouped, or stacked bars.
- Parameters:
*args (
yorx,y) – The data passed as positional or keyword arguments. Interpreted as follows:If only
ycoordinates are passed, try to infer thexcoordinates from theSeriesorDataFrameindices or theDataArraycoordinates. Otherwise, thexcoordinates arenp.arange(0, y.shape[0]).If the
ycoordinates are a 2D array, plot each column of data in succession (except where each column of data represents a statistical distribution, as withboxplot,violinplot, or when usingmeans=Trueormedians=True).If any arguments are
pint.Quantity, auto-add the pint unit registry to matplotlib’s unit registry usingsetup_matplotlib. Apint.Quantityembedded in anxarray.DataArrayis also supported.
width (
floator array-like, default:0.8) – The width(s) of the bars. Can be passed as a third positional argument. Ifabsolute_widthisTrue(the default) these are in units relative to the x coordinate step size. Otherwise these are in x coordinate units.bottom (
floator array-like, default:0) – The coordinate(s) of the bottom edge of the bars. Can be passed as a fourth positional argument.absolute_width (
bool, default:False) – Whether to make thewidthunits absolute. IfTrue, this restores the default matplotlib behavior.stack, stacked (
bool, default:False) – Whether to “stack” bars from successive columns of y data or plot bars side-by-side in groups.bar_labels (
bool, defaultrc[``”bar.bar_labels”``]) – Whether to show the height values for vertical bars or width values for horizontal bars.bar_labels_kw (
dict, defaultNone) – Keywords to format the bar_labels, seebar_label().data (dict-like, optional) – A dict-like dataset container (e.g.,
DataFrameorDataset). If passed, each data argument can optionally be a stringkeyand the arrays used for plotting are retrieved withdata[key]. This is a native matplotlib feature.autoformat (
bool, default:rc.autoformat=True) – Whether thexaxis labels,yaxis labels, axis formatters, axes titles, legend titles, and colorbar labels are automatically configured when aSeries,DataFrame,DataArray, orQuantityis passed to the plotting command. Formatting ofpint.Quantityunit strings is controlled byrc.unitformat='L'.
- Other Parameters:
cycle (
cycle-spec, optional) – The cycle specifer, passed to theCycleconstructor. If the returned cycler is unchanged from the current cycler, the axes cycler will not be reset to its first position. To disable property cycling and just use black for the default color, usecycle=False,cycle='none', orcycle=()(analogous to disabling ticks with e.g.xformatter='none'). To restore the default property cycler, usecycle=True.lw, linewidth, linewidths (
unit-spec, default:rc['patch.linewidth']=0.6) – The edge width of the patch(es). If float, units are points. If string, interpreted byunits.ls, linestyle, linestyles (
str, default:'-') – The edge style of the patch(es).ec, edgecolor, edgecolors (
color-spec, default:'none') – The edge color of the patch(es).fc, facecolor, facecolors, fillcolor, fillcolors (
color-spec, optional) – The face color of the patch(es). The propertycycleis used by default.a, alpha, alphas (
float, optional) – The opacity of the patch(es). Inferred fromfacecolorandedgecolorby default.negpos (
bool, default:False) – Whether to shade bars whereheight >= 0withposcolorand whereheight < 0withnegcolor. IfTruethis function will return a length-2 silent list of handles.negcolor, poscolor (
color-spec, default:rc.negcolor='blue7',rc.poscolor='red7') – Colors to use for the negative and positive bars. Ignored ifnegposisFalse.edgefix (
boolorfloat, default:rc.edgefix=True) – Whether to fix the common issue where white lines appear between adjacent patches in saved vector graphics (this can slow down figure rendering). See this github repo for a demonstration of the problem. IfTrue, a small default linewidth of0.3is used to cover up the white lines. If float (e.g.edgefix=0.5), this specific linewidth is used to cover up the white lines. This feature is automatically disabled when the patches have transparency.mean, means (
bool, default:False) – Whether to plot the means of each column for 2Dycoordinates. Means are calculated withnumpy.nanmean. If no other arguments are specified, this also setsbarstd=True(andboxstd=Truefor violin plots).median, medians (
bool, default:False) – Whether to plot the medians of each column for 2Dycoordinates. Medians are calculated withnumpy.nanmedian. If no other arguments arguments are specified, this also setsbarstd=True(andboxstd=Truefor violin plots).barstd, barstds (
bool,float, or2-tupleoffloat, optional) – Valid only ifmeanormedianisTrue. Standard deviation multiples for thin error bars with optional whiskers (i.e., caps). If scalar, then +/- that multiple is used. IfTrue, the default standard deviation range of +/-3 is used.barpctile, barpctiles (
bool,float, or2-tupleoffloat, optional) – Valid only ifmeanormedianisTrue. As withbarstd, but instead using percentiles for the error bars. If scalar, that percentile range is used (e.g.,90shows the 5th to 95th percentiles). IfTrue, the default percentile range of 0 to 100 is used.bardata (array-like, optional) – Valid only if
meanandmedianareFalse. If shape is 2 x N, these are the lower and upper bounds for the thin error bars. If shape is N, these are the absolute, symmetric deviations from the central points.boxes (
bool, default:None) – Shorthand forboxstd,boxstds.boxstd, boxstds, boxpctile, boxpctiles, boxdata (optional) – As with
barstd,barpctile, andbardata, but for thicker error bars representing a smaller interval than the thin error bars. IfboxstdsisTrue, the default standard deviation range of +/-1 is used. IfboxpctilesisTrue, the default percentile range of 25 to 75 is used (i.e., the interquartile range). When “boxes” and “bars” are combined, this has the effect of drawing miniature box-and-whisker plots.capsize (
float, default:rc['errorbar.capsize']=3.0) – The cap size for thin error bars in points.barz, barzorder, boxz, boxzorder (
float, default:2.5) – The “zorder” for the thin and thick error bars.barc, barcolor, boxc, boxcolor (
color-spec, default:rc['boxplot.whiskerprops.color']='black') – Colors for the thin and thick error bars.barlw, barlinewidth, boxlw, boxlinewidth (
float, default:rc['boxplot.whiskerprops.linewidth']=1.0) – Line widths for the thin and thick error bars, in points. The default for boxes is 4 timesrc['boxplot.whiskerprops.linewidth'].boxm, boxmarker (
boolormarker-spec, default:'o') – Whether to draw a small marker in the middle of the box denoting the mean or median position. Ignored ifboxesisFalse.boxms, boxmarkersize (
size-spec, default:(2 * boxlinewidth) ** 2) – The marker size for theboxmarkermarker in points ** 2.boxmc, boxmarkercolor, boxmec, boxmarkeredgecolor (
color-spec, default:'w') – Color, face color, and edge color for theboxmarkermarker.inbounds (
bool, default:rc['axes.inbounds']=True) – Whether to restrict the defaulty(x) axis limits to account for only in-bounds data when thex(y) axis limits have been locked. See alsorc['axes.inbounds']andrc['cmap.inbounds'].label, value (
floatorstr, optional) – The single legend label or colorbar coordinate to be used for this plotted element. Can be numeric or string. This is generally used with 1D positional arguments.labels, values (sequence of
floator sequence ofstr, optional) – The legend labels or colorbar coordinates used for each plotted element. Can be numeric or string, and must match the number of plotted elements. This is generally used with 2D positional arguments.colorbar (
bool,int, orstr, optional) – If notNone, this is a location specifying where to draw an inset or outer colorbar from the resulting object(s). IfTrue, the defaultrc['colorbar.loc']='right'is used. If the same location is used in successive plotting calls, object(s) will be added to the existing colorbar in that location (valid for colorbars built from lists of artists). Valid locations are shown in incolorbar.colorbar_kw (dict-like, optional) – Extra keyword args for the call to
colorbar.legend (
bool,int, orstr, optional) – Location specifying where to draw an inset or outer legend from the resulting object(s). IfTrue, the defaultrc['legend.loc']='best'is used. If the same location is used in successive plotting calls, object(s) will be added to existing legend in that location. Valid locations are shown inlegend().legend_kw (dict-like, optional) – Extra keyword args for the call to
legend.**kwargs – Passed to
bar.
- barbs(**kwargs)[source]
Plot wind barbs.
- Parameters:
*args (
u,vorx,y,u,v) – The data passed as positional or keyword arguments. Interpreted as follows:If only
uandvcoordinates are passed, try to infer thexandycoordinates from theDataFrameindices and columns or theDataArraycoordinates. Otherwise, theycoordinates arenp.arange(0, y.shape[0])and thexcoordinates arenp.arange(0, y.shape[1]).For
pcolorandpcolormesh, calculate coordinate edges usingedgesor:func:`~ultraplot.utils.edges2d`if centers were provided. For all other methods, calculate coordinate centers if edges were provided.If the
xorycoordinates arepint.Quantity, auto-add the pint unit registry to matplotlib’s unit registry usingsetup_matplotlib. If theuandvcoordinates arepint.Quantity, pass the magnitude to the plotting command. Apint.Quantityembedded in anxarray.DataArrayis also supported.
c, color, colors (array-like or
color-spec, optional) – The colors of the wind barbs passed as either a keyword argument or a fifth positional argument. This can be a single color or a color array to be scaled bycmapandnorm.data (dict-like, optional) – A dict-like dataset container (e.g.,
DataFrameorDataset). If passed, each data argument can optionally be a stringkeyand the arrays used for plotting are retrieved withdata[key]. This is a native matplotlib feature.autoformat (
bool, default:rc.autoformat=True) – Whether thexaxis labels,yaxis labels, axis formatters, axes titles, legend titles, and colorbar labels are automatically configured when aSeries,DataFrame,DataArray, orQuantityis passed to the plotting command. Formatting ofpint.Quantityunit strings is controlled byrc.unitformat='L'.transpose (
bool, default:False) – Whether to transpose the input data. This should be used when passing datasets with column-major dimension order(x, y). Otherwise row-major dimension order(y, x)is expected.order (
{'C', 'F'}, default:'C') – Alternative totranspose.'C'corresponds to the default C-cyle row-major ordering (equivalent totranspose=False).'F'corresponds to Fortran-style column-major ordering (equivalent totranspose=True).globe (
bool, default:False) – Forultraplot.axes.GeoAxesonly. Whether to enforce global coverage. When set toTruethis does the following:Interpolates input data to the North and South poles by setting the data values at the poles to the mean from latitudes nearest each pole.
Makes meridional coverage “circular”, i.e. the last longitude coordinate equals the first longitude coordinate plus 360°.
When basemap is the backend, cycles 1D longitude vectors to fit within the map edges. For example, if the central longitude is 90°, the data is shifted so that it spans -90° to 270°.
- Other Parameters:
cmap (
colormap-spec, default:rc['cmap.sequential']='Fire'orrc['cmap.diverging']='BuRd') – The colormap specifer, passed to theColormapconstructor function. Ifrc['cmap.autodiverging']isTrueand the normalization range contains negative and positive values thenrc['cmap.diverging']is used. Otherwiserc['cmap.sequential']is used.c, color, colors (
color-specor sequence ofcolor-spec, optional) – The color(s) used to create aDiscreteColormap. If not passed,cmapis used.norm (
norm-spec, default:NormalizeorDivergingNorm) – The data value normalizer, passed to theNormconstructor function. IfdiscreteisTruethen 1) this affects the default level-generation algorithm (e.g.norm='log'builds levels in log-space) and 2) this is passed toDiscreteNormto scale the colors before they are discretized (ifnormis not already aDiscreteNorm). Ifrc['cmap.autodiverging']isTrueand the normalization range contains negative and positive values thenDivergingNormis used. OtherwiseNormalizeis used.extend (
{'neither', 'both', 'min', 'max'}, default:'neither') – Direction for drawing colorbar “extensions” indicating out-of-bounds data on the end of the colorbar.discrete (
bool, default:rc['cmap.discrete']=None) – IfFalse, thenDiscreteNormis not applied to the colormap. Instead, for non-contour plots, the number of levels will be roughly controlled byrc['cmap.lut']. This has a similar effect to usinglevels=large_numberbut it may improve rendering speed. Default isTrueonly for contouring commands likecontourfand pseudocolor commands likepcolor.sequential, diverging, cyclic, qualitative (
bool, default:None) – Boolean arguments used ifcmapis not passed. Set these toTrueto use the defaultrc['cmap.sequential'],rc['cmap.diverging'],rc['cmap.cyclic'], andrc['cmap.qualitative']colormaps. Thedivergingoption also appliesDivergingNormas the default continuous normalizer.vmin, vmax (
float, optional) – The minimum and maximum color scale values used with thenormnormalizer. IfdiscreteisFalsethese are the absolute limits, and ifdiscreteisTruethese are the approximate limits used to automatically determinelevelsorvalueslists at “nice” intervals. Iflevelsorvalueswere already passed as lists, these are ignored, andvminandvmaxare set to the minimum and maximum of the lists. Ifrobustwas passed, the defaultvminandvmaxare some percentile range of the data values. Otherwise, the defaultvminandvmaxare the minimum and maximum of the data values.N – Shorthand for
levels.levels (
intor sequence offloat, default:rc['cmap.levels']=11) – The number of level edges or a sequence of level edges. If the former,locatoris used to generate this many level edges at “nice” intervals. If the latter, the levels should be monotonically increasing or decreasing (note decreasing levels fail withcontourplots).values (
intor sequence offloat, default:None) – The number of level centers or a sequence of level centers. If the former,locatoris used to generate this many level centers at “nice” intervals. If the latter, levels are inferred usingedges. This will override anylevelsinput.center_levels (
bool, defaultFalse) – If set to true, the discrete color bar bins will be centered on the level values instead of using the level values as the edges of the discrete bins. This option can be used for diverging, discrete color bars with both positive and negative data to ensure data near zero is properly represented.robust (
bool,float, or2-tuple, default:rc['cmap.robust']=False) – IfTrueandvminorvmaxwere not provided, they are determined from the 2nd and 98th data percentiles rather than the minimum and maximum. If float, this percentile range is used (for example,90corresponds to the 5th to 95th percentiles). If 2-tuple of float, these specific percentiles should be used. This feature is useful when your data has large outliers.inbounds (
bool, default:rc['cmap.inbounds']=True) – IfTrueandvminorvmaxwere not provided, when axis limits have been explicitly restricted withset_xlim()orset_ylim(), out-of-bounds data is ignored. See alsorc['cmap.inbounds']andrc['axes.inbounds'].locator (
locator-spec, default:matplotlib.ticker.MaxNLocator) – The locator used to determine level locations iflevelsorvalueswere not already passed as lists. Passed to theLocatorconstructor. Default isMaxNLocatorwithlevelsinteger levels.locator_kw (dict-like, optional) – Keyword arguments passed to
matplotlib.ticker.Locatorclass.symmetric (
bool, default:False) – IfTrue, the normalization range or discrete colormap levels are symmetric about zero.positive (
bool, default:False) – IfTrue, the normalization range or discrete colormap levels are positive with a minimum at zero.negative (
bool, default:False) – IfTrue, the normaliation range or discrete colormap levels are negative with a minimum at zero.nozero (
bool, default:False) – IfTrue,0is removed from the level list. This is mainly useful for single-colorcontourplots.**kwargs – Passed to
matplotlib.axes.Axes.barbs
- barh(**kwargs)[source]
Plot individual, grouped, or stacked bars.
- Parameters:
*args (
xory,x) – The data passed as positional or keyword arguments. Interpreted as follows:If only
xcoordinates are passed, try to infer theycoordinates from theSeriesorDataFrameindices or theDataArraycoordinates. Otherwise, theycoordinates arenp.arange(0, x.shape[0]).If the
xcoordinates are a 2D array, plot each column of data in succession (except where each column of data represents a statistical distribution, as withboxplot,violinplot, or when usingmeans=Trueormedians=True).If any arguments are
pint.Quantity, auto-add the pint unit registry to matplotlib’s unit registry usingsetup_matplotlib. Apint.Quantityembedded in anxarray.DataArrayis also supported.
width (
floator array-like, default:0.8) – The width(s) of the bars. Can be passed as a third positional argument. Ifabsolute_widthisTrue(the default) these are in units relative to the y coordinate step size. Otherwise these are in y coordinate units.left (
floator array-like, default:0) – The coordinate(s) of the left edge of the bars. Can be passed as a fourth positional argument.absolute_width (
bool, default:False) – Whether to make thewidthunits absolute. IfTrue, this restores the default matplotlib behavior.stack, stacked (
bool, default:False) – Whether to “stack” bars from successive columns of x data or plot bars side-by-side in groups.bar_labels (
bool, defaultrc[``”bar.bar_labels”``]) – Whether to show the height values for vertical bars or width values for horizontal bars.bar_labels_kw (
dict, defaultNone) – Keywords to format the bar_labels, seebar_label().data (dict-like, optional) – A dict-like dataset container (e.g.,
DataFrameorDataset). If passed, each data argument can optionally be a stringkeyand the arrays used for plotting are retrieved withdata[key]. This is a native matplotlib feature.autoformat (
bool, default:rc.autoformat=True) – Whether thexaxis labels,yaxis labels, axis formatters, axes titles, legend titles, and colorbar labels are automatically configured when aSeries,DataFrame,DataArray, orQuantityis passed to the plotting command. Formatting ofpint.Quantityunit strings is controlled byrc.unitformat='L'.
- Other Parameters:
cycle (
cycle-spec, optional) – The cycle specifer, passed to theCycleconstructor. If the returned cycler is unchanged from the current cycler, the axes cycler will not be reset to its first position. To disable property cycling and just use black for the default color, usecycle=False,cycle='none', orcycle=()(analogous to disabling ticks with e.g.xformatter='none'). To restore the default property cycler, usecycle=True.lw, linewidth, linewidths (
unit-spec, default:rc['patch.linewidth']=0.6) – The edge width of the patch(es). If float, units are points. If string, interpreted byunits.ls, linestyle, linestyles (
str, default:'-') – The edge style of the patch(es).ec, edgecolor, edgecolors (
color-spec, default:'none') – The edge color of the patch(es).fc, facecolor, facecolors, fillcolor, fillcolors (
color-spec, optional) – The face color of the patch(es). The propertycycleis used by default.a, alpha, alphas (
float, optional) – The opacity of the patch(es). Inferred fromfacecolorandedgecolorby default.negpos (
bool, default:False) – Whether to shade bars whereheight >= 0withposcolorand whereheight < 0withnegcolor. IfTruethis function will return a length-2 silent list of handles.negcolor, poscolor (
color-spec, default:rc.negcolor='blue7',rc.poscolor='red7') – Colors to use for the negative and positive bars. Ignored ifnegposisFalse.edgefix (
boolorfloat, default:rc.edgefix=True) – Whether to fix the common issue where white lines appear between adjacent patches in saved vector graphics (this can slow down figure rendering). See this github repo for a demonstration of the problem. IfTrue, a small default linewidth of0.3is used to cover up the white lines. If float (e.g.edgefix=0.5), this specific linewidth is used to cover up the white lines. This feature is automatically disabled when the patches have transparency.mean, means (
bool, default:False) – Whether to plot the means of each column for 2Dxcoordinates. Means are calculated withnumpy.nanmean. If no other arguments are specified, this also setsbarstd=True(andboxstd=Truefor violin plots).median, medians (
bool, default:False) – Whether to plot the medians of each column for 2Dxcoordinates. Medians are calculated withnumpy.nanmedian. If no other arguments arguments are specified, this also setsbarstd=True(andboxstd=Truefor violin plots).barstd, barstds (
bool,float, or2-tupleoffloat, optional) – Valid only ifmeanormedianisTrue. Standard deviation multiples for thin error bars with optional whiskers (i.e., caps). If scalar, then +/- that multiple is used. IfTrue, the default standard deviation range of +/-3 is used.barpctile, barpctiles (
bool,float, or2-tupleoffloat, optional) – Valid only ifmeanormedianisTrue. As withbarstd, but instead using percentiles for the error bars. If scalar, that percentile range is used (e.g.,90shows the 5th to 95th percentiles). IfTrue, the default percentile range of 0 to 100 is used.bardata (array-like, optional) – Valid only if
meanandmedianareFalse. If shape is 2 x N, these are the lower and upper bounds for the thin error bars. If shape is N, these are the absolute, symmetric deviations from the central points.boxes (
bool, default:None) – Shorthand forboxstd,boxstds.boxstd, boxstds, boxpctile, boxpctiles, boxdata (optional) – As with
barstd,barpctile, andbardata, but for thicker error bars representing a smaller interval than the thin error bars. IfboxstdsisTrue, the default standard deviation range of +/-1 is used. IfboxpctilesisTrue, the default percentile range of 25 to 75 is used (i.e., the interquartile range). When “boxes” and “bars” are combined, this has the effect of drawing miniature box-and-whisker plots.capsize (
float, default:rc['errorbar.capsize']=3.0) – The cap size for thin error bars in points.barz, barzorder, boxz, boxzorder (
float, default:2.5) – The “zorder” for the thin and thick error bars.barc, barcolor, boxc, boxcolor (
color-spec, default:rc['boxplot.whiskerprops.color']='black') – Colors for the thin and thick error bars.barlw, barlinewidth, boxlw, boxlinewidth (
float, default:rc['boxplot.whiskerprops.linewidth']=1.0) – Line widths for the thin and thick error bars, in points. The default for boxes is 4 timesrc['boxplot.whiskerprops.linewidth'].boxm, boxmarker (
boolormarker-spec, default:'o') – Whether to draw a small marker in the middle of the box denoting the mean or median position. Ignored ifboxesisFalse.boxms, boxmarkersize (
size-spec, default:(2 * boxlinewidth) ** 2) – The marker size for theboxmarkermarker in points ** 2.boxmc, boxmarkercolor, boxmec, boxmarkeredgecolor (
color-spec, default:'w') – Color, face color, and edge color for theboxmarkermarker.inbounds (
bool, default:rc['axes.inbounds']=True) – Whether to restrict the defaulty(x) axis limits to account for only in-bounds data when thex(y) axis limits have been locked. See alsorc['axes.inbounds']andrc['cmap.inbounds'].label, value (
floatorstr, optional) – The single legend label or colorbar coordinate to be used for this plotted element. Can be numeric or string. This is generally used with 1D positional arguments.labels, values (sequence of
floator sequence ofstr, optional) – The legend labels or colorbar coordinates used for each plotted element. Can be numeric or string, and must match the number of plotted elements. This is generally used with 2D positional arguments.colorbar (
bool,int, orstr, optional) – If notNone, this is a location specifying where to draw an inset or outer colorbar from the resulting object(s). IfTrue, the defaultrc['colorbar.loc']='right'is used. If the same location is used in successive plotting calls, object(s) will be added to the existing colorbar in that location (valid for colorbars built from lists of artists). Valid locations are shown in incolorbar.colorbar_kw (dict-like, optional) – Extra keyword args for the call to
colorbar.legend (
bool,int, orstr, optional) – Location specifying where to draw an inset or outer legend from the resulting object(s). IfTrue, the defaultrc['legend.loc']='best'is used. If the same location is used in successive plotting calls, object(s) will be added to existing legend in that location. Valid locations are shown inlegend().legend_kw (dict-like, optional) – Extra keyword args for the call to
legend.**kwargs – Passed to
barh.
- beeswarm(*args, **kwargs)[source]
Beeswarm plot with SHAP-style feature value coloring.
- Parameters:
data (array-like) – The data to be plotted. It is assumed the shape of
datais (N, M) where N is the number of points and M is the number of features.levels (array-like, optional) – The levels to use for the beeswarm plot. If not provided, the levels are automatically determined based on the data.
- n_bins (
intor array-like, default:50) – Number of bins to use to reduce the overlap between points. Bins are used to determine how crowded the points are for each level of the
ycoordinate.- s, size, ms, markersizefloat or array-like or unit-spec, optional
The marker size area(s). If this is an array matching the shape of
xandy, the units are scaled bysminandsmax. If this contains unit string(s), it is processed byunitsand represents the width rather than area.- c, color, colors, mc, markercolor, markercolors, fc, facecolor, facecolorsarray-like or color-spec, optional
The marker color(s). If this is an array matching the shape of
xandy, the colors are generated usingcmap,norm,vmin, andvmax. Otherwise, this should be a valid matplotlib color.- smin, smaxfloat, optional
The minimum and maximum marker size area in units
points ** 2. Ignored ifabsolute_sizeisTrue. Default value forsminis1and forsmaxis the square ofrc['lines.markersize']=6.0.- area_sizebool, default: True
Whether the marker sizes
sare scaled by area or by radius. The defaultTrueis consistent with matplotlib. Whenabsolute_sizeisTrue, thesunits arepoints ** 2ifarea_sizeisTrueandpointsifarea_sizeisFalse.- absolute_sizebool, default: True or False
Whether
sshould be taken to represent “absolute” marker sizes in unitspointsorpoints ** 2or “relative” marker sizes scaled bysminandsmax. Default isTrueifsis scalar andFalseifsis array-like orsminorsmaxwere passed.- vmin, vmaxfloat, optional
The minimum and maximum color scale values used with the
normnormalizer. IfdiscreteisFalsethese are the absolute limits, and ifdiscreteisTruethese are the approximate limits used to automatically determinelevelsorvalueslists at “nice” intervals. Iflevelsorvalueswere already passed as lists, these are ignored, andvminandvmaxare set to the minimum and maximum of the lists. Ifrobustwas passed, the defaultvminandvmaxare some percentile range of the data values. Otherwise, the defaultvminandvmaxare the minimum and maximum of the data values.- datadict-like, optional
A dict-like dataset container (e.g.,
DataFrameorDataset). If passed, each data argument can optionally be a stringkeyand the arrays used for plotting are retrieved withdata[key]. This is a native matplotlib feature.
- n_bins (
- autoformat (
bool, default:rc.autoformat=True) – Whether thexaxis labels,yaxis labels, axis formatters, axes titles, legend titles, and colorbar labels are automatically configured when a
Series,DataFrame,DataArray, orQuantityis passed to the plotting command. Formatting ofpint.Quantityunit strings is controlled byrc.unitformat='L'.
- Other Parameters:
cmap (
colormap-spec, default:rc['cmap.sequential']='Fire'orrc['cmap.diverging']='BuRd') – The colormap specifer, passed to theColormapconstructor function. Ifrc['cmap.autodiverging']isTrueand the normalization range contains negative and positive values thenrc['cmap.diverging']is used. Otherwiserc['cmap.sequential']is used.
- autoformat (
c, color, colors (
color-specor sequence ofcolor-spec, optional) – The color(s) used to create aDiscreteColormap. If not passed,cmapis used.norm (
norm-spec, default:NormalizeorDivergingNorm) – The data value normalizer, passed to theNormconstructor function. IfdiscreteisTruethen 1) this affects the default level-generation algorithm (e.g.norm='log'builds levels in log-space) and 2) this is passed toDiscreteNormto scale the colors before they are discretized (ifnormis not already aDiscreteNorm). Ifrc['cmap.autodiverging']isTrueand the normalization range contains negative and positive values thenDivergingNormis used. OtherwiseNormalizeis used.extend (
{'neither', 'both', 'min', 'max'}, default:'neither') – Direction for drawing colorbar “extensions” indicating out-of-bounds data on the end of the colorbar.discrete (
bool, default:rc['cmap.discrete']=None) – IfFalse, thenDiscreteNormis not applied to the colormap. Instead, for non-contour plots, the number of levels will be roughly controlled byrc['cmap.lut']. This has a similar effect to usinglevels=large_numberbut it may improve rendering speed. Default isTrueonly for contouring commands likecontourfand pseudocolor commands likepcolor.- sequential, diverging, cyclic, qualitative (
bool, default:None) – Boolean arguments used ifcmapis not passed. Set these toTrue to use the default
rc['cmap.sequential'],rc['cmap.diverging'],rc['cmap.cyclic'], andrc['cmap.qualitative']colormaps. Thedivergingoption also appliesDivergingNormas the default continuous normalizer.- N
Shorthand for
levels.
- sequential, diverging, cyclic, qualitative (
levels (
intor sequence offloat, default:rc['cmap.levels']=11) – The number of level edges or a sequence of level edges. If the former,locatoris used to generate this many level edges at “nice” intervals. If the latter, the levels should be monotonically increasing or decreasing (note decreasing levels fail withcontourplots).values (
intor sequence offloat, default:None) – The number of level centers or a sequence of level centers. If the former,locatoris used to generate this many level centers at “nice” intervals. If the latter, levels are inferred usingedges. This will override anylevelsinput.- center_levels (
bool, defaultFalse) – If set to true, the discrete color bar bins will be centered on the level values instead of using the level values as the edges of the discrete bins. This option can be used for diverging, discrete color bars with both positive and negative data to ensure data near zero is properly represented.
- robustbool, float, or 2-tuple, default:
rc['cmap.robust']=False If
Trueandvminorvmaxwere not provided, they are determined from the 2nd and 98th data percentiles rather than the minimum and maximum. If float, this percentile range is used (for example,90corresponds to the 5th to 95th percentiles). If 2-tuple of float, these specific percentiles should be used. This feature is useful when your data has large outliers.
- center_levels (
inbounds (
bool, default:rc['cmap.inbounds']=True) – IfTrueandvminorvmaxwere not provided, when axis limits have been explicitly restricted withset_xlim()orset_ylim(), out-of-bounds data is ignored. See alsorc['cmap.inbounds']andrc['axes.inbounds'].locator (
locator-spec, default:matplotlib.ticker.MaxNLocator) – The locator used to determine level locations iflevelsorvalueswere not already passed as lists. Passed to theLocatorconstructor. Default isMaxNLocatorwithlevelsinteger levels.locator_kw (dict-like, optional) – Keyword arguments passed to
matplotlib.ticker.Locatorclass.symmetric (
bool, default:False) – IfTrue, the normalization range or discrete colormap levels are symmetric about zero.positive (
bool, default:False) – IfTrue, the normalization range or discrete colormap levels are positive with a minimum at zero.negative (
bool, default:False) – IfTrue, the normaliation range or discrete colormap levels are negative with a minimum at zero.- nozero (
bool, default:False) – IfTrue,0is removed from the level list. This is mainly useful for single-color
contourplots.- cyclecycle-spec, optional
The cycle specifer, passed to the
Cycleconstructor. If the returned cycler is unchanged from the current cycler, the axes cycler will not be reset to its first position. To disable property cycling and just use black for the default color, usecycle=False,cycle='none', orcycle=()(analogous to disabling ticks with e.g.xformatter='none'). To restore the default property cycler, usecycle=True.
- nozero (
cycle_kw (dict-like, optional) – Passed to
Cycle. lw, linewidth, linewidths, mew, markeredgewidth, markeredgewidths : float or sequence, optionalThe marker edge width(s).
- edgecolors, markeredgecolor, markeredgecolorscolor-spec or sequence, optional
The marker edge color(s).
- mean, meansbool, default: False
Whether to plot the means of each column for 2D
ycoordinates. Means are calculated withnumpy.nanmean. If no other arguments are specified, this also setsbarstd=True(andboxstd=Truefor violin plots).
- median, medians (
bool, default:False) – Whether to plot the medians of each column for 2Dycoordinates. Medians are calculated with
numpy.nanmedian. If no other arguments arguments are specified, this also setsbarstd=True(andboxstd=Truefor violin plots).- barsbool, default: None
Shorthand for
barstd,barstds.
- median, medians (
barstd, barstds (
bool,float, or2-tupleoffloat, optional) – Valid only ifmeanormedianisTrue. Standard deviation multiples for thin error bars with optional whiskers (i.e., caps). If scalar, then +/- that multiple is used. IfTrue, the default standard deviation range of +/-3 is used.barpctile, barpctiles (
bool,float, or2-tupleoffloat, optional) – Valid only ifmeanormedianisTrue. As withbarstd, but instead using percentiles for the error bars. If scalar, that percentile range is used (e.g.,90shows the 5th to 95th percentiles). IfTrue, the default percentile range of 0 to 100 is used.bardata (array-like, optional) – Valid only if
meanandmedianareFalse. If shape is 2 x N, these are the lower and upper bounds for the thin error bars. If shape is N, these are the absolute, symmetric deviations from the central points.boxes (
bool, default:None) – Shorthand forboxstd,boxstds.boxstd, boxstds, boxpctile, boxpctiles, boxdata (optional) – As with
barstd,barpctile, andbardata, but for thicker error bars representing a smaller interval than the thin error bars. IfboxstdsisTrue, the default standard deviation range of +/-1 is used. IfboxpctilesisTrue, the default percentile range of 25 to 75 is used (i.e., the interquartile range). When “boxes” and “bars” are combined, this has the effect of drawing miniature box-and-whisker plots.capsize (
float, default:rc['errorbar.capsize']=3.0) – The cap size for thin error bars in points.barz, barzorder, boxz, boxzorder (
float, default:2.5) – The “zorder” for the thin and thick error bars.barc, barcolor, boxc, boxcolor (
color-spec, default:rc['boxplot.whiskerprops.color']='black') – Colors for the thin and thick error bars.barlw, barlinewidth, boxlw, boxlinewidth (
float, default:rc['boxplot.whiskerprops.linewidth']=1.0) – Line widths for the thin and thick error bars, in points. The default for boxes is 4 timesrc['boxplot.whiskerprops.linewidth'].boxm, boxmarker (
boolormarker-spec, default:'o') – Whether to draw a small marker in the middle of the box denoting the mean or median position. Ignored ifboxesisFalse.boxms, boxmarkersize (
size-spec, default:(2 * boxlinewidth) ** 2) – The marker size for theboxmarkermarker in points ** 2.boxmc, boxmarkercolor, boxmec, boxmarkeredgecolor (
color-spec, default:'w') – Color, face color, and edge color for theboxmarkermarker. shade : bool, default: NoneShorthand for
shadestd.shadestd, shadestds, shadepctile, shadepctiles, shadedata (optional) – As with
barstd,barpctile, andbardata, but using shading to indicate the error range. IfshadestdsisTrue, the default standard deviation range of +/-2 is used. IfshadepctilesisTrue, the default percentile range of 10 to 90 is used.fadestd, fadestds, fadepctile, fadepctiles, fadedata (optional) – As with
shadestd,shadepctile, andshadedata, but for an additional, more faded, secondary shaded region. IffadestdsisTrue, the default standard deviation range of +/-3 is used. IffadepctilesisTrue, the default percentile range of 0 to 100 is used.shadec, shadecolor, fadec, fadecolor (
color-spec, default:None) – Colors for the different shaded regions. The parent artist color is used by default.shadez, shadezorder, fadez, fadezorder (
float, default:1.5) – The “zorder” for the different shaded regions.shadea, shadealpha, fadea, fadealpha (
float, default:0.4,0.2) – The opacity for the different shaded regions.shadelw, shadelinewidth, fadelw, fadelinewidth (
float, default:rc['patch.linewidth']=0.6.) – The edge line width for the shading patches.shdeec, shadeedgecolor, fadeec, fadeedgecolor (
float, default:'none') – The edge color for the shading patches.- shadelabel, fadelabel (
boolorstr, optional) – Labels for the shaded regions to be used as separate legend entries. To toggle labels “on” and apply a default label, use e.g.
shadelabel=True. To apply a custom label, use e.g.shadelabel='label'. Otherwise, the shading is drawn underneath the line and/or marker in the legend entry.- inboundsbool, default:
rc['axes.inbounds']=True Whether to restrict the default
y(x) axis limits to account for only in-bounds data when thex(y) axis limits have been locked. See alsorc['axes.inbounds']andrc['cmap.inbounds'].- label, valuefloat or str, optional
The single legend label or colorbar coordinate to be used for this plotted element. Can be numeric or string. This is generally used with 1D positional arguments.
- shadelabel, fadelabel (
- labels, values (sequence of
floator sequence ofstr, optional) – The legend labels or colorbar coordinates used for each plotted element. Can be numeric or string, and must match the number of plotted elements. This is generally used with 2D positional arguments.
- colorbarbool, int, or str, optional
If not
None, this is a location specifying where to draw an inset or outer colorbar from the resulting object(s). IfTrue, the defaultrc['colorbar.loc']='right'is used. If the same location is used in successive plotting calls, object(s) will be added to the existing colorbar in that location (valid for colorbars built from lists of artists). Valid locations are shown in incolorbar.
- labels, values (sequence of
colorbar_kw (dict-like, optional) – Extra keyword args for the call to
colorbar.legend (
bool,int, orstr, optional) – Location specifying where to draw an inset or outer legend from the resulting object(s). IfTrue, the defaultrc['legend.loc']='best'is used. If the same location is used in successive plotting calls, object(s) will be added to existing legend in that location. Valid locations are shown inlegend().legend_kw (dict-like, optional) – Extra keyword args for the call to
legend. **kwargsPassed to
scatter.
- box(*args, **kwargs)[source]
Plot vertical boxes and whiskers with a nice default style.
- Parameters:
*args (
yorx,y) – The data passed as positional or keyword arguments. Interpreted as follows:If only
ycoordinates are passed, try to infer thexcoordinates from theSeriesorDataFrameindices or theDataArraycoordinates. Otherwise, thexcoordinates arenp.arange(0, y.shape[0]).If the
ycoordinates are a 2D array, plot each column of data in succession (except where each column of data represents a statistical distribution, as withboxplot,violinplot, or when usingmeans=Trueormedians=True).If any arguments are
pint.Quantity, auto-add the pint unit registry to matplotlib’s unit registry usingsetup_matplotlib. Apint.Quantityembedded in anxarray.DataArrayis also supported.
data (dict-like, optional) – A dict-like dataset container (e.g.,
DataFrameorDataset). If passed, each data argument can optionally be a stringkeyand the arrays used for plotting are retrieved withdata[key]. This is a native matplotlib feature.autoformat (
bool, default:rc.autoformat=True) – Whether thexaxis labels,yaxis labels, axis formatters, axes titles, legend titles, and colorbar labels are automatically configured when aSeries,DataFrame,DataArray, orQuantityis passed to the plotting command. Formatting ofpint.Quantityunit strings is controlled byrc.unitformat='L'.
- Other Parameters:
fill (
bool, default:True) – Whether to fill the box with a color.mean, means (
bool, default:False) – IfTrue, this passesshowmeans=Trueandmeanline=Truetomatplotlib.axes.Axes.boxplot. Adds mean lines alongside the median.cycle (
cycle-spec, optional) – The cycle specifer, passed to theCycleconstructor. If the returned cycler is unchanged from the current cycler, the axes cycler will not be reset to its first position. To disable property cycling and just use black for the default color, usecycle=False,cycle='none', orcycle=()(analogous to disabling ticks with e.g.xformatter='none'). To restore the default property cycler, usecycle=True.lw, linewidth, linewidths (
unit-spec, default:rc['patch.linewidth']=0.6) – The edge width of the patch(es). If float, units are points. If string, interpreted byunits.ls, linestyle, linestyles (
str, default:'-') – The edge style of the patch(es).ec, edgecolor, edgecolors (
color-spec, default:'black') – The edge color of the patch(es).fc, facecolor, facecolors, fillcolor, fillcolors (
color-spec, optional) – The face color of the patch(es). The propertycycleis used by default.a, alpha, alphas (
float, optional) – The opacity of the patch(es). Inferred fromfacecolorandedgecolorby default.m, marker, ms, markersize (
floatorstr, optional) – Marker style and size for the ‘fliers’, i.e. outliers. See theboxplot.flierpropsrcParamssettings.meanls, medianls, meanlinestyle, medianlinestyle, meanlinestyles, medianlinestyles (
str, optional) – Line style for the mean and median lines drawn across the box. See theboxplot.meanpropsandboxplot.medianpropsrcParamssettings.boxc, capc, whiskerc, flierc, meanc, medianc, boxcolor, capcolor, whiskercolor, fliercolor, meancolor, mediancolor boxcolors, capcolors, whiskercolors, fliercolors, meancolors, mediancolors (
color-specor sequence, optional) – Color of various boxplot components. If a sequence, should be the same length as the number of boxes. These are shorthands so you don’t have to pass e.g. aboxpropsdictionary keyword. See theboxplot.boxprops,boxplot.capprops,boxplot.whiskerprops,boxplot.flierprops,boxplot.meanprops, andboxplot.medianpropsrcParamssettings.boxlw, caplw, whiskerlw, flierlw, meanlw, medianlw, boxlinewidth, caplinewidth, meanlinewidth, medianlinewidth, whiskerlinewidth, flierlinewidth, boxlinewidths, caplinewidths, meanlinewidths, medianlinewidths, whiskerlinewidths, flierlinewidths (
float, optional) – Line width of various boxplot components. These are shorthands so you don’t have to pass e.g. aboxpropsdictionary keyword. See theboxplot.boxprops,boxplot.capprops,boxplot.whiskerprops,boxplot.flierprops,boxplot.meanprops, andboxplot.medianpropsrcParamssettings.label, value (
floatorstr, optional) – The single legend label or colorbar coordinate to be used for this plotted element. Can be numeric or string. This is generally used with 1D positional arguments.labels, values (sequence of
floator sequence ofstr, optional) – The legend labels or colorbar coordinates used for each plotted element. Can be numeric or string, and must match the number of plotted elements. This is generally used with 2D positional arguments.**kwargs – Passed to
matplotlib.axes.Axes.boxplot.
See also
PlotAxes.boxes,PlotAxes.boxesh,PlotAxes.boxplot,PlotAxes.boxploth,matplotlib.axes.Axes.boxplot
- boxes(*, new_obj=<function PlotAxes.box>, message="'boxes' was deprecated in version 0.8.0 and may be removed in the next major release (version 2.0.0). Please use 'box' instead.", **kwargs)
- boxh(*args, **kwargs)[source]
Plot horizontal boxes and whiskers with a nice default style.
- Parameters:
*args (
xory,x) – The data passed as positional or keyword arguments. Interpreted as follows:If only
xcoordinates are passed, try to infer theycoordinates from theSeriesorDataFrameindices or theDataArraycoordinates. Otherwise, theycoordinates arenp.arange(0, x.shape[0]).If the
xcoordinates are a 2D array, plot each column of data in succession (except where each column of data represents a statistical distribution, as withboxplot,violinplot, or when usingmeans=Trueormedians=True).If any arguments are
pint.Quantity, auto-add the pint unit registry to matplotlib’s unit registry usingsetup_matplotlib. Apint.Quantityembedded in anxarray.DataArrayis also supported.
data (dict-like, optional) – A dict-like dataset container (e.g.,
DataFrameorDataset). If passed, each data argument can optionally be a stringkeyand the arrays used for plotting are retrieved withdata[key]. This is a native matplotlib feature.autoformat (
bool, default:rc.autoformat=True) – Whether thexaxis labels,yaxis labels, axis formatters, axes titles, legend titles, and colorbar labels are automatically configured when aSeries,DataFrame,DataArray, orQuantityis passed to the plotting command. Formatting ofpint.Quantityunit strings is controlled byrc.unitformat='L'.
- Other Parameters:
fill (
bool, default:True) – Whether to fill the box with a color.mean, means (
bool, default:False) – IfTrue, this passesshowmeans=Trueandmeanline=Truetomatplotlib.axes.Axes.boxplot. Adds mean lines alongside the median.cycle (
cycle-spec, optional) – The cycle specifer, passed to theCycleconstructor. If the returned cycler is unchanged from the current cycler, the axes cycler will not be reset to its first position. To disable property cycling and just use black for the default color, usecycle=False,cycle='none', orcycle=()(analogous to disabling ticks with e.g.xformatter='none'). To restore the default property cycler, usecycle=True.lw, linewidth, linewidths (
unit-spec, default:rc['patch.linewidth']=0.6) – The edge width of the patch(es). If float, units are points. If string, interpreted byunits.ls, linestyle, linestyles (
str, default:'-') – The edge style of the patch(es).ec, edgecolor, edgecolors (
color-spec, default:'black') – The edge color of the patch(es).fc, facecolor, facecolors, fillcolor, fillcolors (
color-spec, optional) – The face color of the patch(es). The propertycycleis used by default.a, alpha, alphas (
float, optional) – The opacity of the patch(es). Inferred fromfacecolorandedgecolorby default.m, marker, ms, markersize (
floatorstr, optional) – Marker style and size for the ‘fliers’, i.e. outliers. See theboxplot.flierpropsrcParamssettings.meanls, medianls, meanlinestyle, medianlinestyle, meanlinestyles, medianlinestyles (
str, optional) – Line style for the mean and median lines drawn across the box. See theboxplot.meanpropsandboxplot.medianpropsrcParamssettings.boxc, capc, whiskerc, flierc, meanc, medianc, boxcolor, capcolor, whiskercolor, fliercolor, meancolor, mediancolor boxcolors, capcolors, whiskercolors, fliercolors, meancolors, mediancolors (
color-specor sequence, optional) – Color of various boxplot components. If a sequence, should be the same length as the number of boxes. These are shorthands so you don’t have to pass e.g. aboxpropsdictionary keyword. See theboxplot.boxprops,boxplot.capprops,boxplot.whiskerprops,boxplot.flierprops,boxplot.meanprops, andboxplot.medianpropsrcParamssettings.boxlw, caplw, whiskerlw, flierlw, meanlw, medianlw, boxlinewidth, caplinewidth, meanlinewidth, medianlinewidth, whiskerlinewidth, flierlinewidth, boxlinewidths, caplinewidths, meanlinewidths, medianlinewidths, whiskerlinewidths, flierlinewidths (
float, optional) – Line width of various boxplot components. These are shorthands so you don’t have to pass e.g. aboxpropsdictionary keyword. See theboxplot.boxprops,boxplot.capprops,boxplot.whiskerprops,boxplot.flierprops,boxplot.meanprops, andboxplot.medianpropsrcParamssettings.label, value (
floatorstr, optional) – The single legend label or colorbar coordinate to be used for this plotted element. Can be numeric or string. This is generally used with 1D positional arguments.labels, values (sequence of
floator sequence ofstr, optional) – The legend labels or colorbar coordinates used for each plotted element. Can be numeric or string, and must match the number of plotted elements. This is generally used with 2D positional arguments.**kwargs – Passed to
matplotlib.axes.Axes.boxplot.
See also
PlotAxes.boxes,PlotAxes.boxesh,PlotAxes.boxplot,PlotAxes.boxploth,matplotlib.axes.Axes.boxplot
- boxplot(**kwargs)[source]
Plot vertical boxes and whiskers with a nice default style.
- Parameters:
*args (
yorx,y) – The data passed as positional or keyword arguments. Interpreted as follows:If only
ycoordinates are passed, try to infer thexcoordinates from theSeriesorDataFrameindices or theDataArraycoordinates. Otherwise, thexcoordinates arenp.arange(0, y.shape[0]).If the
ycoordinates are a 2D array, plot each column of data in succession (except where each column of data represents a statistical distribution, as withboxplot,violinplot, or when usingmeans=Trueormedians=True).If any arguments are
pint.Quantity, auto-add the pint unit registry to matplotlib’s unit registry usingsetup_matplotlib. Apint.Quantityembedded in anxarray.DataArrayis also supported.
data (dict-like, optional) – A dict-like dataset container (e.g.,
DataFrameorDataset). If passed, each data argument can optionally be a stringkeyand the arrays used for plotting are retrieved withdata[key]. This is a native matplotlib feature.autoformat (
bool, default:rc.autoformat=True) – Whether thexaxis labels,yaxis labels, axis formatters, axes titles, legend titles, and colorbar labels are automatically configured when aSeries,DataFrame,DataArray, orQuantityis passed to the plotting command. Formatting ofpint.Quantityunit strings is controlled byrc.unitformat='L'.
- Other Parameters:
fill (
bool, default:True) – Whether to fill the box with a color.mean, means (
bool, default:False) – IfTrue, this passesshowmeans=Trueandmeanline=Truetomatplotlib.axes.Axes.boxplot. Adds mean lines alongside the median.cycle (
cycle-spec, optional) – The cycle specifer, passed to theCycleconstructor. If the returned cycler is unchanged from the current cycler, the axes cycler will not be reset to its first position. To disable property cycling and just use black for the default color, usecycle=False,cycle='none', orcycle=()(analogous to disabling ticks with e.g.xformatter='none'). To restore the default property cycler, usecycle=True.lw, linewidth, linewidths (
unit-spec, default:rc['patch.linewidth']=0.6) – The edge width of the patch(es). If float, units are points. If string, interpreted byunits.ls, linestyle, linestyles (
str, default:'-') – The edge style of the patch(es).ec, edgecolor, edgecolors (
color-spec, default:'black') – The edge color of the patch(es).fc, facecolor, facecolors, fillcolor, fillcolors (
color-spec, optional) – The face color of the patch(es). The propertycycleis used by default.a, alpha, alphas (
float, optional) – The opacity of the patch(es). Inferred fromfacecolorandedgecolorby default.m, marker, ms, markersize (
floatorstr, optional) – Marker style and size for the ‘fliers’, i.e. outliers. See theboxplot.flierpropsrcParamssettings.meanls, medianls, meanlinestyle, medianlinestyle, meanlinestyles, medianlinestyles (
str, optional) – Line style for the mean and median lines drawn across the box. See theboxplot.meanpropsandboxplot.medianpropsrcParamssettings.boxc, capc, whiskerc, flierc, meanc, medianc, boxcolor, capcolor, whiskercolor, fliercolor, meancolor, mediancolor boxcolors, capcolors, whiskercolors, fliercolors, meancolors, mediancolors (
color-specor sequence, optional) – Color of various boxplot components. If a sequence, should be the same length as the number of boxes. These are shorthands so you don’t have to pass e.g. aboxpropsdictionary keyword. See theboxplot.boxprops,boxplot.capprops,boxplot.whiskerprops,boxplot.flierprops,boxplot.meanprops, andboxplot.medianpropsrcParamssettings.boxlw, caplw, whiskerlw, flierlw, meanlw, medianlw, boxlinewidth, caplinewidth, meanlinewidth, medianlinewidth, whiskerlinewidth, flierlinewidth, boxlinewidths, caplinewidths, meanlinewidths, medianlinewidths, whiskerlinewidths, flierlinewidths (
float, optional) – Line width of various boxplot components. These are shorthands so you don’t have to pass e.g. aboxpropsdictionary keyword. See theboxplot.boxprops,boxplot.capprops,boxplot.whiskerprops,boxplot.flierprops,boxplot.meanprops, andboxplot.medianpropsrcParamssettings.label, value (
floatorstr, optional) – The single legend label or colorbar coordinate to be used for this plotted element. Can be numeric or string. This is generally used with 1D positional arguments.labels, values (sequence of
floator sequence ofstr, optional) – The legend labels or colorbar coordinates used for each plotted element. Can be numeric or string, and must match the number of plotted elements. This is generally used with 2D positional arguments.**kwargs – Passed to
matplotlib.axes.Axes.boxplot.
See also
PlotAxes.boxes,PlotAxes.boxesh,PlotAxes.boxplot,PlotAxes.boxploth,matplotlib.axes.Axes.boxplot
- boxploth(*args, **kwargs)[source]
Plot horizontal boxes and whiskers with a nice default style.
- Parameters:
*args (
xory,x) – The data passed as positional or keyword arguments. Interpreted as follows:If only
xcoordinates are passed, try to infer theycoordinates from theSeriesorDataFrameindices or theDataArraycoordinates. Otherwise, theycoordinates arenp.arange(0, x.shape[0]).If the
xcoordinates are a 2D array, plot each column of data in succession (except where each column of data represents a statistical distribution, as withboxplot,violinplot, or when usingmeans=Trueormedians=True).If any arguments are
pint.Quantity, auto-add the pint unit registry to matplotlib’s unit registry usingsetup_matplotlib. Apint.Quantityembedded in anxarray.DataArrayis also supported.
data (dict-like, optional) – A dict-like dataset container (e.g.,
DataFrameorDataset). If passed, each data argument can optionally be a stringkeyand the arrays used for plotting are retrieved withdata[key]. This is a native matplotlib feature.autoformat (
bool, default:rc.autoformat=True) – Whether thexaxis labels,yaxis labels, axis formatters, axes titles, legend titles, and colorbar labels are automatically configured when aSeries,DataFrame,DataArray, orQuantityis passed to the plotting command. Formatting ofpint.Quantityunit strings is controlled byrc.unitformat='L'.
- Other Parameters:
fill (
bool, default:True) – Whether to fill the box with a color.mean, means (
bool, default:False) – IfTrue, this passesshowmeans=Trueandmeanline=Truetomatplotlib.axes.Axes.boxplot. Adds mean lines alongside the median.cycle (
cycle-spec, optional) – The cycle specifer, passed to theCycleconstructor. If the returned cycler is unchanged from the current cycler, the axes cycler will not be reset to its first position. To disable property cycling and just use black for the default color, usecycle=False,cycle='none', orcycle=()(analogous to disabling ticks with e.g.xformatter='none'). To restore the default property cycler, usecycle=True.lw, linewidth, linewidths (
unit-spec, default:rc['patch.linewidth']=0.6) – The edge width of the patch(es). If float, units are points. If string, interpreted byunits.ls, linestyle, linestyles (
str, default:'-') – The edge style of the patch(es).ec, edgecolor, edgecolors (
color-spec, default:'black') – The edge color of the patch(es).fc, facecolor, facecolors, fillcolor, fillcolors (
color-spec, optional) – The face color of the patch(es). The propertycycleis used by default.a, alpha, alphas (
float, optional) – The opacity of the patch(es). Inferred fromfacecolorandedgecolorby default.m, marker, ms, markersize (
floatorstr, optional) – Marker style and size for the ‘fliers’, i.e. outliers. See theboxplot.flierpropsrcParamssettings.meanls, medianls, meanlinestyle, medianlinestyle, meanlinestyles, medianlinestyles (
str, optional) – Line style for the mean and median lines drawn across the box. See theboxplot.meanpropsandboxplot.medianpropsrcParamssettings.boxc, capc, whiskerc, flierc, meanc, medianc, boxcolor, capcolor, whiskercolor, fliercolor, meancolor, mediancolor boxcolors, capcolors, whiskercolors, fliercolors, meancolors, mediancolors (
color-specor sequence, optional) – Color of various boxplot components. If a sequence, should be the same length as the number of boxes. These are shorthands so you don’t have to pass e.g. aboxpropsdictionary keyword. See theboxplot.boxprops,boxplot.capprops,boxplot.whiskerprops,boxplot.flierprops,boxplot.meanprops, andboxplot.medianpropsrcParamssettings.boxlw, caplw, whiskerlw, flierlw, meanlw, medianlw, boxlinewidth, caplinewidth, meanlinewidth, medianlinewidth, whiskerlinewidth, flierlinewidth, boxlinewidths, caplinewidths, meanlinewidths, medianlinewidths, whiskerlinewidths, flierlinewidths (
float, optional) – Line width of various boxplot components. These are shorthands so you don’t have to pass e.g. aboxpropsdictionary keyword. See theboxplot.boxprops,boxplot.capprops,boxplot.whiskerprops,boxplot.flierprops,boxplot.meanprops, andboxplot.medianpropsrcParamssettings.label, value (
floatorstr, optional) – The single legend label or colorbar coordinate to be used for this plotted element. Can be numeric or string. This is generally used with 1D positional arguments.labels, values (sequence of
floator sequence ofstr, optional) – The legend labels or colorbar coordinates used for each plotted element. Can be numeric or string, and must match the number of plotted elements. This is generally used with 2D positional arguments.**kwargs – Passed to
matplotlib.axes.Axes.boxplot.
See also
PlotAxes.boxes,PlotAxes.boxesh,PlotAxes.boxplot,PlotAxes.boxploth,matplotlib.axes.Axes.boxplot
- contour(**kwargs)[source]
Plot contour lines.
- Parameters:
*args (
zorx,y,z) – The data passed as positional or keyword arguments. Interpreted as follows:If only
zcoordinates are passed, try to infer thexandycoordinates from theDataFrameindices and columns or theDataArraycoordinates. Otherwise, theycoordinates arenp.arange(0, y.shape[0])and thexcoordinates arenp.arange(0, y.shape[1]).For
pcolorandpcolormesh, calculate coordinate edges usingedgesor:func:`~ultraplot.utils.edges2d`if centers were provided. For all other methods, calculate coordinate centers if edges were provided.If the
xorycoordinates arepint.Quantity, auto-add the pint unit registry to matplotlib’s unit registry usingsetup_matplotlib. If thezcoordinates arepint.Quantity, pass the magnitude to the plotting command. Apint.Quantityembedded in anxarray.DataArrayis also supported.
data (dict-like, optional) – A dict-like dataset container (e.g.,
DataFrameorDataset). If passed, each data argument can optionally be a stringkeyand the arrays used for plotting are retrieved withdata[key]. This is a native matplotlib feature.autoformat (
bool, default:rc.autoformat=True) – Whether thexaxis labels,yaxis labels, axis formatters, axes titles, legend titles, and colorbar labels are automatically configured when aSeries,DataFrame,DataArray, orQuantityis passed to the plotting command. Formatting ofpint.Quantityunit strings is controlled byrc.unitformat='L'.transpose (
bool, default:False) – Whether to transpose the input data. This should be used when passing datasets with column-major dimension order(x, y). Otherwise row-major dimension order(y, x)is expected.order (
{'C', 'F'}, default:'C') – Alternative totranspose.'C'corresponds to the default C-cyle row-major ordering (equivalent totranspose=False).'F'corresponds to Fortran-style column-major ordering (equivalent totranspose=True).globe (
bool, default:False) – Forultraplot.axes.GeoAxesonly. Whether to enforce global coverage. When set toTruethis does the following:Interpolates input data to the North and South poles by setting the data values at the poles to the mean from latitudes nearest each pole.
Makes meridional coverage “circular”, i.e. the last longitude coordinate equals the first longitude coordinate plus 360°.
When basemap is the backend, cycles 1D longitude vectors to fit within the map edges. For example, if the central longitude is 90°, the data is shifted so that it spans -90° to 270°.
- Other Parameters:
cmap (
colormap-spec, default:rc['cmap.sequential']='Fire'orrc['cmap.diverging']='BuRd') – The colormap specifer, passed to theColormapconstructor function. Ifrc['cmap.autodiverging']isTrueand the normalization range contains negative and positive values thenrc['cmap.diverging']is used. Otherwiserc['cmap.sequential']is used.c, color, colors (
color-specor sequence ofcolor-spec, optional) – The color(s) used to create aDiscreteColormap. If not passed,cmapis used.norm (
norm-spec, default:NormalizeorDivergingNorm) – The data value normalizer, passed to theNormconstructor function. IfdiscreteisTruethen 1) this affects the default level-generation algorithm (e.g.norm='log'builds levels in log-space) and 2) this is passed toDiscreteNormto scale the colors before they are discretized (ifnormis not already aDiscreteNorm). Ifrc['cmap.autodiverging']isTrueand the normalization range contains negative and positive values thenDivergingNormis used. OtherwiseNormalizeis used.extend (
{'neither', 'both', 'min', 'max'}, default:'neither') – Direction for drawing colorbar “extensions” indicating out-of-bounds data on the end of the colorbar.discrete (
bool, default:rc['cmap.discrete']=None) – IfFalse, thenDiscreteNormis not applied to the colormap. Instead, for non-contour plots, the number of levels will be roughly controlled byrc['cmap.lut']. This has a similar effect to usinglevels=large_numberbut it may improve rendering speed. Default isTrueonly for contouring commands likecontourfand pseudocolor commands likepcolor.sequential, diverging, cyclic, qualitative (
bool, default:None) – Boolean arguments used ifcmapis not passed. Set these toTrueto use the defaultrc['cmap.sequential'],rc['cmap.diverging'],rc['cmap.cyclic'], andrc['cmap.qualitative']colormaps. Thedivergingoption also appliesDivergingNormas the default continuous normalizer.vmin, vmax (
float, optional) – The minimum and maximum color scale values used with thenormnormalizer. IfdiscreteisFalsethese are the absolute limits, and ifdiscreteisTruethese are the approximate limits used to automatically determinelevelsorvalueslists at “nice” intervals. Iflevelsorvalueswere already passed as lists, these are ignored, andvminandvmaxare set to the minimum and maximum of the lists. Ifrobustwas passed, the defaultvminandvmaxare some percentile range of the data values. Otherwise, the defaultvminandvmaxare the minimum and maximum of the data values.N – Shorthand for
levels.levels (
intor sequence offloat, default:rc['cmap.levels']=11) – The number of level edges or a sequence of level edges. If the former,locatoris used to generate this many level edges at “nice” intervals. If the latter, the levels should be monotonically increasing or decreasing (note decreasing levels fail withcontourplots).values (
intor sequence offloat, default:None) – The number of level centers or a sequence of level centers. If the former,locatoris used to generate this many level centers at “nice” intervals. If the latter, levels are inferred usingedges. This will override anylevelsinput.center_levels (
bool, defaultFalse) – If set to true, the discrete color bar bins will be centered on the level values instead of using the level values as the edges of the discrete bins. This option can be used for diverging, discrete color bars with both positive and negative data to ensure data near zero is properly represented.robust (
bool,float, or2-tuple, default:rc['cmap.robust']=False) – IfTrueandvminorvmaxwere not provided, they are determined from the 2nd and 98th data percentiles rather than the minimum and maximum. If float, this percentile range is used (for example,90corresponds to the 5th to 95th percentiles). If 2-tuple of float, these specific percentiles should be used. This feature is useful when your data has large outliers.inbounds (
bool, default:rc['cmap.inbounds']=True) – IfTrueandvminorvmaxwere not provided, when axis limits have been explicitly restricted withset_xlim()orset_ylim(), out-of-bounds data is ignored. See alsorc['cmap.inbounds']andrc['axes.inbounds'].locator (
locator-spec, default:matplotlib.ticker.MaxNLocator) – The locator used to determine level locations iflevelsorvalueswere not already passed as lists. Passed to theLocatorconstructor. Default isMaxNLocatorwithlevelsinteger levels.locator_kw (dict-like, optional) – Keyword arguments passed to
matplotlib.ticker.Locatorclass.symmetric (
bool, default:False) – IfTrue, the normalization range or discrete colormap levels are symmetric about zero.positive (
bool, default:False) – IfTrue, the normalization range or discrete colormap levels are positive with a minimum at zero.negative (
bool, default:False) – IfTrue, the normaliation range or discrete colormap levels are negative with a minimum at zero.nozero (
bool, default:False) – IfTrue,0is removed from the level list. This is mainly useful for single-colorcontourplots.lw, linewidth, linewidths (
unit-spec, default:0.3orrc['lines.linewidth']=1.5) – The width of the line contours. Default is0.3when adding to filled contours orrc['lines.linewidth']=1.5otherwise. If float, units are points. If string, interpreted byunits.ls, linestyle, linestyles (
str, default:'-'orrc['contour.negative_linestyle']='dashed') – The style of the line contours. Default is'-'for positive contours andrc['contour.negative_linestyle']for negative contours.ec, edgecolor, edgecolors (
color-spec, default:'k'orinferred) – The color of the line contours. Default is'k'when adding to filled contours or inferred fromcolororcmapotherwise.a, alpha, alpha (
float, optional) – The opacity of the contours. Inferred fromedgecolorby default.label (
str, optional) – The legend label to be used for this object. In the case of contours, this is paired with the the central artist in the artist list returned bymatplotlib.contour.ContourSet.legend_elements.labels (
bool, optional) – Whether to apply labels to contours and grid boxes. The text will be white when the luminance of the underlying filled contour or grid box is less than 50 and black otherwise.labels_kw (dict-like, optional) – Ignored if
labelsisFalse. Extra keyword args for the labels. For contour plots, this is passed toclabel. Otherwise, this is passed totext.formatter, fmt (
formatter-spec, optional) – TheFormatterused to format number labels. Passed to theFormatterconstructor.formatter_kw (dict-like, optional) – Keyword arguments passed to
matplotlib.ticker.Formatterclass.precision (
int, optional) – The maximum number of decimal places for number labels generated with the default formatterSimpleformatter.colorbar (
bool,int, orstr, optional) – If notNone, this is a location specifying where to draw an inset or outer colorbar from the resulting object(s). IfTrue, the defaultrc['colorbar.loc']='right'is used. If the same location is used in successive plotting calls, object(s) will be added to the existing colorbar in that location (valid for colorbars built from lists of artists). Valid locations are shown in incolorbar.colorbar_kw (dict-like, optional) – Extra keyword args for the call to
colorbar.legend (
bool,int, orstr, optional) – Location specifying where to draw an inset or outer legend from the resulting object(s). IfTrue, the defaultrc['legend.loc']='best'is used. If the same location is used in successive plotting calls, object(s) will be added to existing legend in that location. Valid locations are shown inlegend().legend_kw (dict-like, optional) – Extra keyword args for the call to
legend.**kwargs – Passed to
matplotlib.axes.Axes.contour.
- contourf(**kwargs)[source]
Plot filled contours.
- Parameters:
*args (
zorx,y,z) – The data passed as positional or keyword arguments. Interpreted as follows:If only
zcoordinates are passed, try to infer thexandycoordinates from theDataFrameindices and columns or theDataArraycoordinates. Otherwise, theycoordinates arenp.arange(0, y.shape[0])and thexcoordinates arenp.arange(0, y.shape[1]).For
pcolorandpcolormesh, calculate coordinate edges usingedgesor:func:`~ultraplot.utils.edges2d`if centers were provided. For all other methods, calculate coordinate centers if edges were provided.If the
xorycoordinates arepint.Quantity, auto-add the pint unit registry to matplotlib’s unit registry usingsetup_matplotlib. If thezcoordinates arepint.Quantity, pass the magnitude to the plotting command. Apint.Quantityembedded in anxarray.DataArrayis also supported.
data (dict-like, optional) – A dict-like dataset container (e.g.,
DataFrameorDataset). If passed, each data argument can optionally be a stringkeyand the arrays used for plotting are retrieved withdata[key]. This is a native matplotlib feature.autoformat (
bool, default:rc.autoformat=True) – Whether thexaxis labels,yaxis labels, axis formatters, axes titles, legend titles, and colorbar labels are automatically configured when aSeries,DataFrame,DataArray, orQuantityis passed to the plotting command. Formatting ofpint.Quantityunit strings is controlled byrc.unitformat='L'.transpose (
bool, default:False) – Whether to transpose the input data. This should be used when passing datasets with column-major dimension order(x, y). Otherwise row-major dimension order(y, x)is expected.order (
{'C', 'F'}, default:'C') – Alternative totranspose.'C'corresponds to the default C-cyle row-major ordering (equivalent totranspose=False).'F'corresponds to Fortran-style column-major ordering (equivalent totranspose=True).globe (
bool, default:False) – Forultraplot.axes.GeoAxesonly. Whether to enforce global coverage. When set toTruethis does the following:Interpolates input data to the North and South poles by setting the data values at the poles to the mean from latitudes nearest each pole.
Makes meridional coverage “circular”, i.e. the last longitude coordinate equals the first longitude coordinate plus 360°.
When basemap is the backend, cycles 1D longitude vectors to fit within the map edges. For example, if the central longitude is 90°, the data is shifted so that it spans -90° to 270°.
- Other Parameters:
cmap (
colormap-spec, default:rc['cmap.sequential']='Fire'orrc['cmap.diverging']='BuRd') – The colormap specifer, passed to theColormapconstructor function. Ifrc['cmap.autodiverging']isTrueand the normalization range contains negative and positive values thenrc['cmap.diverging']is used. Otherwiserc['cmap.sequential']is used.c, color, colors (
color-specor sequence ofcolor-spec, optional) – The color(s) used to create aDiscreteColormap. If not passed,cmapis used.norm (
norm-spec, default:NormalizeorDivergingNorm) – The data value normalizer, passed to theNormconstructor function. IfdiscreteisTruethen 1) this affects the default level-generation algorithm (e.g.norm='log'builds levels in log-space) and 2) this is passed toDiscreteNormto scale the colors before they are discretized (ifnormis not already aDiscreteNorm). Ifrc['cmap.autodiverging']isTrueand the normalization range contains negative and positive values thenDivergingNormis used. OtherwiseNormalizeis used.extend (
{'neither', 'both', 'min', 'max'}, default:'neither') – Direction for drawing colorbar “extensions” indicating out-of-bounds data on the end of the colorbar.discrete (
bool, default:rc['cmap.discrete']=None) – IfFalse, thenDiscreteNormis not applied to the colormap. Instead, for non-contour plots, the number of levels will be roughly controlled byrc['cmap.lut']. This has a similar effect to usinglevels=large_numberbut it may improve rendering speed. Default isTrueonly for contouring commands likecontourfand pseudocolor commands likepcolor.sequential, diverging, cyclic, qualitative (
bool, default:None) – Boolean arguments used ifcmapis not passed. Set these toTrueto use the defaultrc['cmap.sequential'],rc['cmap.diverging'],rc['cmap.cyclic'], andrc['cmap.qualitative']colormaps. Thedivergingoption also appliesDivergingNormas the default continuous normalizer.vmin, vmax (
float, optional) – The minimum and maximum color scale values used with thenormnormalizer. IfdiscreteisFalsethese are the absolute limits, and ifdiscreteisTruethese are the approximate limits used to automatically determinelevelsorvalueslists at “nice” intervals. Iflevelsorvalueswere already passed as lists, these are ignored, andvminandvmaxare set to the minimum and maximum of the lists. Ifrobustwas passed, the defaultvminandvmaxare some percentile range of the data values. Otherwise, the defaultvminandvmaxare the minimum and maximum of the data values.N – Shorthand for
levels.levels (
intor sequence offloat, default:rc['cmap.levels']=11) – The number of level edges or a sequence of level edges. If the former,locatoris used to generate this many level edges at “nice” intervals. If the latter, the levels should be monotonically increasing or decreasing (note decreasing levels fail withcontourplots).values (
intor sequence offloat, default:None) – The number of level centers or a sequence of level centers. If the former,locatoris used to generate this many level centers at “nice” intervals. If the latter, levels are inferred usingedges. This will override anylevelsinput.center_levels (
bool, defaultFalse) – If set to true, the discrete color bar bins will be centered on the level values instead of using the level values as the edges of the discrete bins. This option can be used for diverging, discrete color bars with both positive and negative data to ensure data near zero is properly represented.robust (
bool,float, or2-tuple, default:rc['cmap.robust']=False) – IfTrueandvminorvmaxwere not provided, they are determined from the 2nd and 98th data percentiles rather than the minimum and maximum. If float, this percentile range is used (for example,90corresponds to the 5th to 95th percentiles). If 2-tuple of float, these specific percentiles should be used. This feature is useful when your data has large outliers.inbounds (
bool, default:rc['cmap.inbounds']=True) – IfTrueandvminorvmaxwere not provided, when axis limits have been explicitly restricted withset_xlim()orset_ylim(), out-of-bounds data is ignored. See alsorc['cmap.inbounds']andrc['axes.inbounds'].locator (
locator-spec, default:matplotlib.ticker.MaxNLocator) – The locator used to determine level locations iflevelsorvalueswere not already passed as lists. Passed to theLocatorconstructor. Default isMaxNLocatorwithlevelsinteger levels.locator_kw (dict-like, optional) – Keyword arguments passed to
matplotlib.ticker.Locatorclass.symmetric (
bool, default:False) – IfTrue, the normalization range or discrete colormap levels are symmetric about zero.positive (
bool, default:False) – IfTrue, the normalization range or discrete colormap levels are positive with a minimum at zero.negative (
bool, default:False) – IfTrue, the normaliation range or discrete colormap levels are negative with a minimum at zero.nozero (
bool, default:False) – IfTrue,0is removed from the level list. This is mainly useful for single-colorcontourplots.lw, linewidth, linewidths (
unit-spec, default:0.3orrc['lines.linewidth']=1.5) – The width of the line contours. Default is0.3when adding to filled contours orrc['lines.linewidth']=1.5otherwise. If float, units are points. If string, interpreted byunits.ls, linestyle, linestyles (
str, default:'-'orrc['contour.negative_linestyle']='dashed') – The style of the line contours. Default is'-'for positive contours andrc['contour.negative_linestyle']for negative contours.ec, edgecolor, edgecolors (
color-spec, default:'k'orinferred) – The color of the line contours. Default is'k'when adding to filled contours or inferred fromcolororcmapotherwise.a, alpha, alpha (
float, optional) – The opacity of the contours. Inferred fromedgecolorby default.edgefix : bool or float, default:rc.edgefix=TrueWhether to fix the common issue where white lines appear between adjacent patches in saved vector graphics (this can slow down figure rendering). See this github repo for a demonstration of the problem. IfTrue, a small default linewidth of0.3is used to cover up the white lines. If float (e.g.edgefix=0.5), this specific linewidth is used to cover up the white lines. This feature is automatically disabled when the patches have transparency.label (
str, optional) – The legend label to be used for this object. In the case of contours, this is paired with the the central artist in the artist list returned bymatplotlib.contour.ContourSet.legend_elements.labels (
bool, optional) – Whether to apply labels to contours and grid boxes. The text will be white when the luminance of the underlying filled contour or grid box is less than 50 and black otherwise.labels_kw (dict-like, optional) – Ignored if
labelsisFalse. Extra keyword args for the labels. For contour plots, this is passed toclabel. Otherwise, this is passed totext.formatter, fmt (
formatter-spec, optional) – TheFormatterused to format number labels. Passed to theFormatterconstructor.formatter_kw (dict-like, optional) – Keyword arguments passed to
matplotlib.ticker.Formatterclass.precision (
int, optional) – The maximum number of decimal places for number labels generated with the default formatterSimpleformatter.colorbar (
bool,int, orstr, optional) – If notNone, this is a location specifying where to draw an inset or outer colorbar from the resulting object(s). IfTrue, the defaultrc['colorbar.loc']='right'is used. If the same location is used in successive plotting calls, object(s) will be added to the existing colorbar in that location (valid for colorbars built from lists of artists). Valid locations are shown in incolorbar.colorbar_kw (dict-like, optional) – Extra keyword args for the call to
colorbar.legend (
bool,int, orstr, optional) – Location specifying where to draw an inset or outer legend from the resulting object(s). IfTrue, the defaultrc['legend.loc']='best'is used. If the same location is used in successive plotting calls, object(s) will be added to existing legend in that location. Valid locations are shown inlegend().legend_kw (dict-like, optional) – Extra keyword args for the call to
legend.**kwargs – Passed to
matplotlib.axes.Axes.contourf.
- curved_quiver(x: ndarray, y: ndarray, u: ndarray, v: ndarray, linewidth: float | None = None, color: str | Any | None = None, cmap: Any | None = None, norm: Any | None = None, arrowsize: float | None = None, arrowstyle: str | None = None, transform: Any | None = None, zorder: int | None = None, start_points: ndarray | None = None, scale: float | None = None, grains: int | None = None, density: int | None = None, arrow_at_end: bool | None = None)[source]
Draws curved vector field arrows (streamlines with arrows) for 2D vector fields.
- Parameters:
x, y (
1Dor2D arrays) – Grid coordinates.u, v (
2D arrays) – Vector components.color (
coloror2D array, optional) – Streamline color.density (
floator(float,float), optional) – Controls the closeness of streamlines.grains (
intor(int,int), optional) – Number of seed points in x and y.linewidth (
floator2D array, optional) – Width of streamlines.cmap, norm (optional) – Colormap and normalization for array colors.
arrowsize (
float, optional) – Arrow size scaling.arrowstyle (
str, optional) – Arrow style specification.transform (optional) – Matplotlib transform.
zorder (
float, optional) – Z-order for lines/arrows.start_points (
(N,2) array, optional) – Starting points for streamlines.
- Returns:
CurvedQuiverSet– Container with attributes: - lines: LineCollection of streamlines - arrows: PatchCollection of arrows
Notes
The implementation of this function is based on the
dfm_toolsrepository. Original file: https://github.com/Deltares/dfm_tools/blob/829e76f48ebc42460aae118cc190147a595a5f26/dfm_tools/modplot.py
- fill_between(**kwargs)[source]
Plot individual, grouped, or overlaid shading patches.
- Parameters:
*args (
y2orx,y2, orx,y1,y2) – The data passed as positional or keyword arguments. Interpreted as follows:If only
ycoordinates are passed, try to infer thexcoordinates from theSeriesorDataFrameindices or theDataArraycoordinates. Otherwise, thexcoordinates arenp.arange(0, y2.shape[0]).If only
xandy2coordinates are passed, set they1coordinates to zero. This draws elements originating from the zero line.If both
y1andy2are provided, draw elements between these points. If either are 2D, draw elements by iterating over each column.If any arguments are
pint.Quantity, auto-add the pint unit registry to matplotlib’s unit registry usingsetup_matplotlib. Apint.Quantityembedded in anxarray.DataArrayis also supported.
stack, stacked (
bool, default:False) – Whether to “stack” area patches from successive columns of y data or plot area patches on top of each other.data (dict-like, optional) – A dict-like dataset container (e.g.,
DataFrameorDataset). If passed, each data argument can optionally be a stringkeyand the arrays used for plotting are retrieved withdata[key]. This is a native matplotlib feature.autoformat (
bool, default:rc.autoformat=True) – Whether thexaxis labels,yaxis labels, axis formatters, axes titles, legend titles, and colorbar labels are automatically configured when aSeries,DataFrame,DataArray, orQuantityis passed to the plotting command. Formatting ofpint.Quantityunit strings is controlled byrc.unitformat='L'.
- Other Parameters:
where (
ndarray, optional) – A boolean mask for the points that should be shaded. See this matplotlib example.cycle (
cycle-spec, optional) – The cycle specifer, passed to theCycleconstructor. If the returned cycler is unchanged from the current cycler, the axes cycler will not be reset to its first position. To disable property cycling and just use black for the default color, usecycle=False,cycle='none', orcycle=()(analogous to disabling ticks with e.g.xformatter='none'). To restore the default property cycler, usecycle=True.lw, linewidth, linewidths (
unit-spec, default:rc['patch.linewidth']=0.6) – The edge width of the patch(es). If float, units are points. If string, interpreted byunits.ls, linestyle, linestyles (
str, default:'-') – The edge style of the patch(es).ec, edgecolor, edgecolors (
color-spec, default:'none') – The edge color of the patch(es).fc, facecolor, facecolors, fillcolor, fillcolors (
color-spec, optional) – The face color of the patch(es). The propertycycleis used by default.a, alpha, alphas (
float, optional) – The opacity of the patch(es). Inferred fromfacecolorandedgecolorby default.negpos (
bool, default:False) – Whether to shade patches wherey2 >= y1withposcolorand wherey2 < y1withnegcolor. IfTruethis function will return a length-2 silent list of handles.negcolor, poscolor (
color-spec, default:rc.negcolor='blue7',rc.poscolor='red7') – Colors to use for the negative and positive patches. Ignored ifnegposisFalse.edgefix (
boolorfloat, default:rc.edgefix=True) – Whether to fix the common issue where white lines appear between adjacent patches in saved vector graphics (this can slow down figure rendering). See this github repo for a demonstration of the problem. IfTrue, a small default linewidth of0.3is used to cover up the white lines. If float (e.g.edgefix=0.5), this specific linewidth is used to cover up the white lines. This feature is automatically disabled when the patches have transparency.inbounds (
bool, default:rc['axes.inbounds']=True) – Whether to restrict the defaulty(x) axis limits to account for only in-bounds data when thex(y) axis limits have been locked. See alsorc['axes.inbounds']andrc['cmap.inbounds'].label, value (
floatorstr, optional) – The single legend label or colorbar coordinate to be used for this plotted element. Can be numeric or string. This is generally used with 1D positional arguments.labels, values (sequence of
floator sequence ofstr, optional) – The legend labels or colorbar coordinates used for each plotted element. Can be numeric or string, and must match the number of plotted elements. This is generally used with 2D positional arguments.colorbar (
bool,int, orstr, optional) – If notNone, this is a location specifying where to draw an inset or outer colorbar from the resulting object(s). IfTrue, the defaultrc['colorbar.loc']='right'is used. If the same location is used in successive plotting calls, object(s) will be added to the existing colorbar in that location (valid for colorbars built from lists of artists). Valid locations are shown in incolorbar.colorbar_kw (dict-like, optional) – Extra keyword args for the call to
colorbar.legend (
bool,int, orstr, optional) – Location specifying where to draw an inset or outer legend from the resulting object(s). IfTrue, the defaultrc['legend.loc']='best'is used. If the same location is used in successive plotting calls, object(s) will be added to existing legend in that location. Valid locations are shown inlegend().legend_kw (dict-like, optional) – Extra keyword args for the call to
legend.**kwargs – Passed to
fill_between.
- fill_betweenx(**kwargs)[source]
Plot individual, grouped, or overlaid shading patches.
- Parameters:
*args (
x2ory,x2, ory,x1,x2) – The data passed as positional or keyword arguments. Interpreted as follows:If only
xcoordinates are passed, try to infer theycoordinates from theSeriesorDataFrameindices or theDataArraycoordinates. Otherwise, theycoordinates arenp.arange(0, x2.shape[0]).If only
yandx2coordinates are passed, set thex1coordinates to zero. This draws elements originating from the zero line.If both
x1andx2are provided, draw elements between these points. If either are 2D, draw elements by iterating over each column.If any arguments are
pint.Quantity, auto-add the pint unit registry to matplotlib’s unit registry usingsetup_matplotlib. Apint.Quantityembedded in anxarray.DataArrayis also supported.
stack, stacked (
bool, default:False) – Whether to “stack” area patches from successive columns of x data or plot area patches on top of each other.data (dict-like, optional) – A dict-like dataset container (e.g.,
DataFrameorDataset). If passed, each data argument can optionally be a stringkeyand the arrays used for plotting are retrieved withdata[key]. This is a native matplotlib feature.autoformat (
bool, default:rc.autoformat=True) – Whether thexaxis labels,yaxis labels, axis formatters, axes titles, legend titles, and colorbar labels are automatically configured when aSeries,DataFrame,DataArray, orQuantityis passed to the plotting command. Formatting ofpint.Quantityunit strings is controlled byrc.unitformat='L'.
- Other Parameters:
where (
ndarray, optional) – A boolean mask for the points that should be shaded. See this matplotlib example.cycle (
cycle-spec, optional) – The cycle specifer, passed to theCycleconstructor. If the returned cycler is unchanged from the current cycler, the axes cycler will not be reset to its first position. To disable property cycling and just use black for the default color, usecycle=False,cycle='none', orcycle=()(analogous to disabling ticks with e.g.xformatter='none'). To restore the default property cycler, usecycle=True.lw, linewidth, linewidths (
unit-spec, default:rc['patch.linewidth']=0.6) – The edge width of the patch(es). If float, units are points. If string, interpreted byunits.ls, linestyle, linestyles (
str, default:'-') – The edge style of the patch(es).ec, edgecolor, edgecolors (
color-spec, default:'none') – The edge color of the patch(es).fc, facecolor, facecolors, fillcolor, fillcolors (
color-spec, optional) – The face color of the patch(es). The propertycycleis used by default.a, alpha, alphas (
float, optional) – The opacity of the patch(es). Inferred fromfacecolorandedgecolorby default.negpos (
bool, default:False) – Whether to shade patches wherey2 >= y1withposcolorand wherey2 < y1withnegcolor. IfTruethis function will return a length-2 silent list of handles.negcolor, poscolor (
color-spec, default:rc.negcolor='blue7',rc.poscolor='red7') – Colors to use for the negative and positive patches. Ignored ifnegposisFalse.edgefix (
boolorfloat, default:rc.edgefix=True) – Whether to fix the common issue where white lines appear between adjacent patches in saved vector graphics (this can slow down figure rendering). See this github repo for a demonstration of the problem. IfTrue, a small default linewidth of0.3is used to cover up the white lines. If float (e.g.edgefix=0.5), this specific linewidth is used to cover up the white lines. This feature is automatically disabled when the patches have transparency.inbounds (
bool, default:rc['axes.inbounds']=True) – Whether to restrict the defaulty(x) axis limits to account for only in-bounds data when thex(y) axis limits have been locked. See alsorc['axes.inbounds']andrc['cmap.inbounds'].label, value (
floatorstr, optional) – The single legend label or colorbar coordinate to be used for this plotted element. Can be numeric or string. This is generally used with 1D positional arguments.labels, values (sequence of
floator sequence ofstr, optional) – The legend labels or colorbar coordinates used for each plotted element. Can be numeric or string, and must match the number of plotted elements. This is generally used with 2D positional arguments.colorbar (
bool,int, orstr, optional) – If notNone, this is a location specifying where to draw an inset or outer colorbar from the resulting object(s). IfTrue, the defaultrc['colorbar.loc']='right'is used. If the same location is used in successive plotting calls, object(s) will be added to the existing colorbar in that location (valid for colorbars built from lists of artists). Valid locations are shown in incolorbar.colorbar_kw (dict-like, optional) – Extra keyword args for the call to
colorbar.legend (
bool,int, orstr, optional) – Location specifying where to draw an inset or outer legend from the resulting object(s). IfTrue, the defaultrc['legend.loc']='best'is used. If the same location is used in successive plotting calls, object(s) will be added to existing legend in that location. Valid locations are shown inlegend().legend_kw (dict-like, optional) – Extra keyword args for the call to
legend.**kwargs – Passed to
fill_betweenx.
- graph(g: nx.Graph | ndarray, layout: str | dict | Callable = None, nodes: None | bool | Iterable = None, edges: None | bool | Iterable = None, labels: None | bool | Iterable = None, layout_kw: dict | None = None, node_kw: dict | None = None, edge_kw: dict | None = None, label_kw: dict | None = None, rescale: None | bool = None)[source]
Plot a networkx graph with flexible node, edge, and label options.
- Parameters:
g (
networkx.Graph) – The graph object to be plotted. Can be any subclass ofGraph, such asDiGraphorMultiGraph.layout (
callable()ordict, optional) – A layout function or a precomputed dict mapping nodes to 2D positions. If a function is given, it is called aslayout(g, **layout_kw)to compute positions. Seenetworkx.drawing.nx_pylab.draw()for more information.nodes (
booloriterable, default:rc[``”graph.draw_nodes”``]) – Which nodes to draw. IfTrue, all nodes are drawn. If an iterable is provided, only the specified nodes are included. This effectively acts asnodelistinnetworkx.drawing.nx_pylab.draw_networkx_nodes().edges (
booloriterable, default:rc[``”graph.draw_edges”``]) – Which edges to draw. IfTrue, all edges are drawn. If an iterable of edge tuples is provided, only those edges are included. This effectively acts asedgelistinnetworkx.drawing.nx_pylab.draw_networkx_edges().labels (
booloriterable, default:rc["graph.draw_labels]) – Whether to show node labels. IfTrue, labels are drawn using node names. If an iterable is given, only those nodes are labeled.layout_kw (
dict, default:{}) – Keyword arguments passed to the layout function, iflayoutis callable, see networkx’s drawing functions for more information.node_kw (
dict, default:{}) – Additional keyword arguments passed to the node drawing function (seenetworkx.drawing.nx_pylab.draw_networkx_nodes()). These can include size, color, edgecolor, cmap, alpha, etc., depending on the backend used, seenetworkx.drawing.nx_pylab.draw_networkx_nodes().edge_kw (
dict, default:{}) – Additional keyword arguments passed to the edge drawing function. These can include width, color, style, alpha, arrows, etc (seenetworkx.drawing.nx_pylab.draw_networkx_edges()).label_kw (
dict, default:{}) – Additional keyword arguments passed to the label drawing function, such as font size, font color, background color, alignment, etc (seenetworkx.drawing.nx_pylab.draw_networkx_labels()).rescale (
bool, None, default:None.) – When set to none it checks forrc["graph.rescale"]which defaults toTrue. This performs a rescale such that the node position is within a [0, 1] x [0, 1] box.
- Returns:
Nodes,edges,labels output from the networkx drawing functions.
See also
networkx.draw,networkx.draw_networkx,networkx.draw_networkx_nodes,networkx.draw_networkx_edges,networkx.draw_networkx_labels
- heatmap(*args, aspect=None, **kwargs)[source]
Plot grid boxes with formatting suitable for heatmaps. Ensures square grid boxes, adds major ticks to the center of each grid box, disables minor ticks and gridlines, and sets
rc['cmap.discrete']toFalseby default.- Parameters:
*args (
zorx,y,z) – The data passed as positional or keyword arguments. Interpreted as follows:If only
zcoordinates are passed, try to infer thexandycoordinates from theDataFrameindices and columns or theDataArraycoordinates. Otherwise, theycoordinates arenp.arange(0, y.shape[0])and thexcoordinates arenp.arange(0, y.shape[1]).For
pcolorandpcolormesh, calculate coordinate edges usingedgesor:func:`~ultraplot.utils.edges2d`if centers were provided. For all other methods, calculate coordinate centers if edges were provided.If the
xorycoordinates arepint.Quantity, auto-add the pint unit registry to matplotlib’s unit registry usingsetup_matplotlib. If thezcoordinates arepint.Quantity, pass the magnitude to the plotting command. Apint.Quantityembedded in anxarray.DataArrayis also supported.
data (dict-like, optional) – A dict-like dataset container (e.g.,
DataFrameorDataset). If passed, each data argument can optionally be a stringkeyand the arrays used for plotting are retrieved withdata[key]. This is a native matplotlib feature.autoformat (
bool, default:rc.autoformat=True) – Whether thexaxis labels,yaxis labels, axis formatters, axes titles, legend titles, and colorbar labels are automatically configured when aSeries,DataFrame,DataArray, orQuantityis passed to the plotting command. Formatting ofpint.Quantityunit strings is controlled byrc.unitformat='L'.transpose (
bool, default:False) – Whether to transpose the input data. This should be used when passing datasets with column-major dimension order(x, y). Otherwise row-major dimension order(y, x)is expected.order (
{'C', 'F'}, default:'C') – Alternative totranspose.'C'corresponds to the default C-cyle row-major ordering (equivalent totranspose=False).'F'corresponds to Fortran-style column-major ordering (equivalent totranspose=True).globe (
bool, default:False) – Forultraplot.axes.GeoAxesonly. Whether to enforce global coverage. When set toTruethis does the following:Interpolates input data to the North and South poles by setting the data values at the poles to the mean from latitudes nearest each pole.
Makes meridional coverage “circular”, i.e. the last longitude coordinate equals the first longitude coordinate plus 360°.
When basemap is the backend, cycles 1D longitude vectors to fit within the map edges. For example, if the central longitude is 90°, the data is shifted so that it spans -90° to 270°.
aspect (
{'equal', 'auto'}orfloat, default:rc['image.aspet']) – Modify the axes aspect ratio. The aspect ratio is of particular relevance for heatmaps since it may lead to non-square grid boxes. This parameter is a shortcut for callingset_aspect. The options are as follows:Number: The data aspect ratio.
'equal': A data aspect ratio of 1.'auto': Allows the data aspect ratio to change depending on the layout. In general this results in non-square grid boxes.
- Other Parameters:
cmap (
colormap-spec, default:rc['cmap.sequential']='Fire'orrc['cmap.diverging']='BuRd') – The colormap specifer, passed to theColormapconstructor function. Ifrc['cmap.autodiverging']isTrueand the normalization range contains negative and positive values thenrc['cmap.diverging']is used. Otherwiserc['cmap.sequential']is used.c, color, colors (
color-specor sequence ofcolor-spec, optional) – The color(s) used to create aDiscreteColormap. If not passed,cmapis used.norm (
norm-spec, default:NormalizeorDivergingNorm) – The data value normalizer, passed to theNormconstructor function. IfdiscreteisTruethen 1) this affects the default level-generation algorithm (e.g.norm='log'builds levels in log-space) and 2) this is passed toDiscreteNormto scale the colors before they are discretized (ifnormis not already aDiscreteNorm). Ifrc['cmap.autodiverging']isTrueand the normalization range contains negative and positive values thenDivergingNormis used. OtherwiseNormalizeis used.extend (
{'neither', 'both', 'min', 'max'}, default:'neither') – Direction for drawing colorbar “extensions” indicating out-of-bounds data on the end of the colorbar.discrete (
bool, default:rc['cmap.discrete']=None) – IfFalse, thenDiscreteNormis not applied to the colormap. Instead, for non-contour plots, the number of levels will be roughly controlled byrc['cmap.lut']. This has a similar effect to usinglevels=large_numberbut it may improve rendering speed. Default isTrueonly for contouring commands likecontourfand pseudocolor commands likepcolor.sequential, diverging, cyclic, qualitative (
bool, default:None) – Boolean arguments used ifcmapis not passed. Set these toTrueto use the defaultrc['cmap.sequential'],rc['cmap.diverging'],rc['cmap.cyclic'], andrc['cmap.qualitative']colormaps. Thedivergingoption also appliesDivergingNormas the default continuous normalizer.vmin, vmax (
float, optional) – The minimum and maximum color scale values used with thenormnormalizer. IfdiscreteisFalsethese are the absolute limits, and ifdiscreteisTruethese are the approximate limits used to automatically determinelevelsorvalueslists at “nice” intervals. Iflevelsorvalueswere already passed as lists, these are ignored, andvminandvmaxare set to the minimum and maximum of the lists. Ifrobustwas passed, the defaultvminandvmaxare some percentile range of the data values. Otherwise, the defaultvminandvmaxare the minimum and maximum of the data values.N – Shorthand for
levels.levels (
intor sequence offloat, default:rc['cmap.levels']=11) – The number of level edges or a sequence of level edges. If the former,locatoris used to generate this many level edges at “nice” intervals. If the latter, the levels should be monotonically increasing or decreasing (note decreasing levels fail withcontourplots).values (
intor sequence offloat, default:None) – The number of level centers or a sequence of level centers. If the former,locatoris used to generate this many level centers at “nice” intervals. If the latter, levels are inferred usingedges. This will override anylevelsinput.center_levels (
bool, defaultFalse) – If set to true, the discrete color bar bins will be centered on the level values instead of using the level values as the edges of the discrete bins. This option can be used for diverging, discrete color bars with both positive and negative data to ensure data near zero is properly represented.robust (
bool,float, or2-tuple, default:rc['cmap.robust']=False) – IfTrueandvminorvmaxwere not provided, they are determined from the 2nd and 98th data percentiles rather than the minimum and maximum. If float, this percentile range is used (for example,90corresponds to the 5th to 95th percentiles). If 2-tuple of float, these specific percentiles should be used. This feature is useful when your data has large outliers.inbounds (
bool, default:rc['cmap.inbounds']=True) – IfTrueandvminorvmaxwere not provided, when axis limits have been explicitly restricted withset_xlim()orset_ylim(), out-of-bounds data is ignored. See alsorc['cmap.inbounds']andrc['axes.inbounds'].locator (
locator-spec, default:matplotlib.ticker.MaxNLocator) – The locator used to determine level locations iflevelsorvalueswere not already passed as lists. Passed to theLocatorconstructor. Default isMaxNLocatorwithlevelsinteger levels.locator_kw (dict-like, optional) – Keyword arguments passed to
matplotlib.ticker.Locatorclass.symmetric (
bool, default:False) – IfTrue, the normalization range or discrete colormap levels are symmetric about zero.positive (
bool, default:False) – IfTrue, the normalization range or discrete colormap levels are positive with a minimum at zero.negative (
bool, default:False) – IfTrue, the normaliation range or discrete colormap levels are negative with a minimum at zero.nozero (
bool, default:False) – IfTrue,0is removed from the level list. This is mainly useful for single-colorcontourplots.lw, linewidth, linewidths (
unit-spec, default:0.3) – The width of lines between grid boxes. If float, units are points. If string, interpreted byunits.ls, linestyle, linestyles (
str, default:'-') – The style of lines between grid boxes.ec, edgecolor, edgecolors (
color-spec, default:'k') – The color of lines between grid boxes.a, alpha, alphas (
float, optional) – The opacity of the grid boxes. Inferred fromcmapby default.edgefix (
boolorfloat, default:rc.edgefix=True) – Whether to fix the common issue where white lines appear between adjacent patches in saved vector graphics (this can slow down figure rendering). See this github repo for a demonstration of the problem. IfTrue, a small default linewidth of0.3is used to cover up the white lines. If float (e.g.edgefix=0.5), this specific linewidth is used to cover up the white lines. This feature is automatically disabled when the patches have transparency.label (
str, optional) – The legend label to be used for this object. In the case of contours, this is paired with the the central artist in the artist list returned bymatplotlib.contour.ContourSet.legend_elements.labels (
bool, optional) – Whether to apply labels to contours and grid boxes. The text will be white when the luminance of the underlying filled contour or grid box is less than 50 and black otherwise.labels_kw (dict-like, optional) – Ignored if
labelsisFalse. Extra keyword args for the labels. For contour plots, this is passed toclabel. Otherwise, this is passed totext.formatter, fmt (
formatter-spec, optional) – TheFormatterused to format number labels. Passed to theFormatterconstructor.formatter_kw (dict-like, optional) – Keyword arguments passed to
matplotlib.ticker.Formatterclass.precision (
int, optional) – The maximum number of decimal places for number labels generated with the default formatterSimpleformatter.colorbar (
bool,int, orstr, optional) – If notNone, this is a location specifying where to draw an inset or outer colorbar from the resulting object(s). IfTrue, the defaultrc['colorbar.loc']='right'is used. If the same location is used in successive plotting calls, object(s) will be added to the existing colorbar in that location (valid for colorbars built from lists of artists). Valid locations are shown in incolorbar.colorbar_kw (dict-like, optional) – Extra keyword args for the call to
colorbar.legend (
bool,int, orstr, optional) – Location specifying where to draw an inset or outer legend from the resulting object(s). IfTrue, the defaultrc['legend.loc']='best'is used. If the same location is used in successive plotting calls, object(s) will be added to existing legend in that location. Valid locations are shown inlegend().legend_kw (dict-like, optional) – Extra keyword args for the call to
legend.**kwargs – Passed to
matplotlib.axes.Axes.pcolormesh.
- hexbin(**kwargs)[source]
Plot a 2D hexagonally binned histogram. standard 2D histogram.
- Parameters:
*args (
yorx,y) – The data passed as positional or keyword arguments. Interpreted as follows:If only
ycoordinates are passed, try to infer thexcoordinates from theSeriesorDataFrameindices or theDataArraycoordinates. Otherwise, thexcoordinates arenp.arange(0, y.shape[0]).If the
ycoordinates are a 2D array, plot each column of data in succession (except where each column of data represents a statistical distribution, as withboxplot,violinplot, or when usingmeans=Trueormedians=True).If any arguments are
pint.Quantity, auto-add the pint unit registry to matplotlib’s unit registry usingsetup_matplotlib. Apint.Quantityembedded in anxarray.DataArrayis also supported.
weights (array-like, optional) – The weights associated with each point. If string this can be retrieved from
data(see below).data (dict-like, optional) – A dict-like dataset container (e.g.,
DataFrameorDataset). If passed, each data argument can optionally be a stringkeyand the arrays used for plotting are retrieved withdata[key]. This is a native matplotlib feature.autoformat (
bool, default:rc.autoformat=True) – Whether thexaxis labels,yaxis labels, axis formatters, axes titles, legend titles, and colorbar labels are automatically configured when aSeries,DataFrame,DataArray, orQuantityis passed to the plotting command. Formatting ofpint.Quantityunit strings is controlled byrc.unitformat='L'.
- Other Parameters:
cmap (
colormap-spec, default:rc['cmap.sequential']='Fire'orrc['cmap.diverging']='BuRd') – The colormap specifer, passed to theColormapconstructor function. Ifrc['cmap.autodiverging']isTrueand the normalization range contains negative and positive values thenrc['cmap.diverging']is used. Otherwiserc['cmap.sequential']is used.c, color, colors (
color-specor sequence ofcolor-spec, optional) – The color(s) used to create aDiscreteColormap. If not passed,cmapis used.norm (
norm-spec, default:NormalizeorDivergingNorm) – The data value normalizer, passed to theNormconstructor function. IfdiscreteisTruethen 1) this affects the default level-generation algorithm (e.g.norm='log'builds levels in log-space) and 2) this is passed toDiscreteNormto scale the colors before they are discretized (ifnormis not already aDiscreteNorm). Ifrc['cmap.autodiverging']isTrueand the normalization range contains negative and positive values thenDivergingNormis used. OtherwiseNormalizeis used.extend (
{'neither', 'both', 'min', 'max'}, default:'neither') – Direction for drawing colorbar “extensions” indicating out-of-bounds data on the end of the colorbar.discrete (
bool, default:rc['cmap.discrete']=None) – IfFalse, thenDiscreteNormis not applied to the colormap. Instead, for non-contour plots, the number of levels will be roughly controlled byrc['cmap.lut']. This has a similar effect to usinglevels=large_numberbut it may improve rendering speed. Default isTrueonly for contouring commands likecontourfand pseudocolor commands likepcolor.sequential, diverging, cyclic, qualitative (
bool, default:None) – Boolean arguments used ifcmapis not passed. Set these toTrueto use the defaultrc['cmap.sequential'],rc['cmap.diverging'],rc['cmap.cyclic'], andrc['cmap.qualitative']colormaps. Thedivergingoption also appliesDivergingNormas the default continuous normalizer.vmin, vmax (
float, optional) – The minimum and maximum color scale values used with thenormnormalizer. IfdiscreteisFalsethese are the absolute limits, and ifdiscreteisTruethese are the approximate limits used to automatically determinelevelsorvalueslists at “nice” intervals. Iflevelsorvalueswere already passed as lists, these are ignored, andvminandvmaxare set to the minimum and maximum of the lists. Ifrobustwas passed, the defaultvminandvmaxare some percentile range of the data values. Otherwise, the defaultvminandvmaxare the minimum and maximum of the data values.N – Shorthand for
levels.levels (
intor sequence offloat, default:rc['cmap.levels']=11) – The number of level edges or a sequence of level edges. If the former,locatoris used to generate this many level edges at “nice” intervals. If the latter, the levels should be monotonically increasing or decreasing (note decreasing levels fail withcontourplots).values (
intor sequence offloat, default:None) – The number of level centers or a sequence of level centers. If the former,locatoris used to generate this many level centers at “nice” intervals. If the latter, levels are inferred usingedges. This will override anylevelsinput.center_levels (
bool, defaultFalse) – If set to true, the discrete color bar bins will be centered on the level values instead of using the level values as the edges of the discrete bins. This option can be used for diverging, discrete color bars with both positive and negative data to ensure data near zero is properly represented.robust (
bool,float, or2-tuple, default:rc['cmap.robust']=False) – IfTrueandvminorvmaxwere not provided, they are determined from the 2nd and 98th data percentiles rather than the minimum and maximum. If float, this percentile range is used (for example,90corresponds to the 5th to 95th percentiles). If 2-tuple of float, these specific percentiles should be used. This feature is useful when your data has large outliers.inbounds (
bool, default:rc['cmap.inbounds']=True) – IfTrueandvminorvmaxwere not provided, when axis limits have been explicitly restricted withset_xlim()orset_ylim(), out-of-bounds data is ignored. See alsorc['cmap.inbounds']andrc['axes.inbounds'].locator (
locator-spec, default:matplotlib.ticker.MaxNLocator) – The locator used to determine level locations iflevelsorvalueswere not already passed as lists. Passed to theLocatorconstructor. Default isMaxNLocatorwithlevelsinteger levels.locator_kw (dict-like, optional) – Keyword arguments passed to
matplotlib.ticker.Locatorclass.symmetric (
bool, default:False) – IfTrue, the normalization range or discrete colormap levels are symmetric about zero.positive (
bool, default:False) – IfTrue, the normalization range or discrete colormap levels are positive with a minimum at zero.negative (
bool, default:False) – IfTrue, the normaliation range or discrete colormap levels are negative with a minimum at zero.nozero (
bool, default:False) – IfTrue,0is removed from the level list. This is mainly useful for single-colorcontourplots.label (
str, optional) – The legend label to be used for this object. In the case of contours, this is paired with the the central artist in the artist list returned bymatplotlib.contour.ContourSet.legend_elements.labels (
bool, optional) – Whether to apply labels to contours and grid boxes. The text will be white when the luminance of the underlying filled contour or grid box is less than 50 and black otherwise.labels_kw (dict-like, optional) – Ignored if
labelsisFalse. Extra keyword args for the labels. For contour plots, this is passed toclabel. Otherwise, this is passed totext.formatter, fmt (
formatter-spec, optional) – TheFormatterused to format number labels. Passed to theFormatterconstructor.formatter_kw (dict-like, optional) – Keyword arguments passed to
matplotlib.ticker.Formatterclass.precision (
int, optional) – The maximum number of decimal places for number labels generated with the default formatterSimpleformatter.colorbar (
bool,int, orstr, optional) – If notNone, this is a location specifying where to draw an inset or outer colorbar from the resulting object(s). IfTrue, the defaultrc['colorbar.loc']='right'is used. If the same location is used in successive plotting calls, object(s) will be added to the existing colorbar in that location (valid for colorbars built from lists of artists). Valid locations are shown in incolorbar.colorbar_kw (dict-like, optional) – Extra keyword args for the call to
colorbar.legend (
bool,int, orstr, optional) – Location specifying where to draw an inset or outer legend from the resulting object(s). IfTrue, the defaultrc['legend.loc']='best'is used. If the same location is used in successive plotting calls, object(s) will be added to existing legend in that location. Valid locations are shown inlegend().legend_kw (dict-like, optional) – Extra keyword args for the call to
legend.**kwargs – Passed to
hexbin.
- hist(**kwargs)[source]
Plot vertical histograms.
- Parameters:
*args (
xory,x) – The data passed as positional or keyword arguments. Interpreted as follows:If only
xcoordinates are passed, try to infer theycoordinates from theSeriesorDataFrameindices or theDataArraycoordinates. Otherwise, theycoordinates arenp.arange(0, x.shape[0]).If the
xcoordinates are a 2D array, plot each column of data in succession (except where each column of data represents a statistical distribution, as withboxplot,violinplot, or when usingmeans=Trueormedians=True).If any arguments are
pint.Quantity, auto-add the pint unit registry to matplotlib’s unit registry usingsetup_matplotlib. Apint.Quantityembedded in anxarray.DataArrayis also supported.
bins (
intor sequence offloat, optional) – The bin count or exact bin edges.weights (array-like, optional) – The weights associated with each point. If string this can be retrieved from
data(see below).histtype (
{'bar', 'barstacked', 'step', 'stepfilled'}, optional) – The histogram type. Seematplotlib.axes.Axes.histfor details.width, rwidth (
float, default:0.8or1) – The bar width(s) for bar-type histograms relative to the bin size. Default is0.8for multiple columns of unstacked data and1otherwise.stack, stacked (
bool, optional) – Whether to “stack” successive columns of x data for bar-type histograms or show side-by-side in groups. Setting this toFalseis equivalent tohisttype='bar'and toTrueis equivalent tohisttype='barstacked'.fill, filled (
bool, optional) – Whether to “fill” step-type histograms or just plot the edges. Setting this toFalseis equivalent tohisttype='step'and toTrueis equivalent tohisttype='stepfilled'.data (dict-like, optional) – A dict-like dataset container (e.g.,
DataFrameorDataset). If passed, each data argument can optionally be a stringkeyand the arrays used for plotting are retrieved withdata[key]. This is a native matplotlib feature.autoformat (
bool, default:rc.autoformat=True) – Whether thexaxis labels,yaxis labels, axis formatters, axes titles, legend titles, and colorbar labels are automatically configured when aSeries,DataFrame,DataArray, orQuantityis passed to the plotting command. Formatting ofpint.Quantityunit strings is controlled byrc.unitformat='L'.
- Other Parameters:
cycle (
cycle-spec, optional) – The cycle specifer, passed to theCycleconstructor. If the returned cycler is unchanged from the current cycler, the axes cycler will not be reset to its first position. To disable property cycling and just use black for the default color, usecycle=False,cycle='none', orcycle=()(analogous to disabling ticks with e.g.xformatter='none'). To restore the default property cycler, usecycle=True.lw, linewidth, linewidths (
unit-spec, default:rc['patch.linewidth']=0.6) – The edge width of the patch(es). If float, units are points. If string, interpreted byunits.ls, linestyle, linestyles (
str, default:'-') – The edge style of the patch(es).ec, edgecolor, edgecolors (
color-spec, default:'none') – The edge color of the patch(es).fc, facecolor, facecolors, fillcolor, fillcolors (
color-spec, optional) – The face color of the patch(es). The propertycycleis used by default.a, alpha, alphas (
float, optional) – The opacity of the patch(es). Inferred fromfacecolorandedgecolorby default.edgefix (
boolorfloat, default:rc.edgefix=True) – Whether to fix the common issue where white lines appear between adjacent patches in saved vector graphics (this can slow down figure rendering). See this github repo for a demonstration of the problem. IfTrue, a small default linewidth of0.3is used to cover up the white lines. If float (e.g.edgefix=0.5), this specific linewidth is used to cover up the white lines. This feature is automatically disabled when the patches have transparency.label, value (
floatorstr, optional) – The single legend label or colorbar coordinate to be used for this plotted element. Can be numeric or string. This is generally used with 1D positional arguments.labels, values (sequence of
floator sequence ofstr, optional) – The legend labels or colorbar coordinates used for each plotted element. Can be numeric or string, and must match the number of plotted elements. This is generally used with 2D positional arguments.colorbar (
bool,int, orstr, optional) – If notNone, this is a location specifying where to draw an inset or outer colorbar from the resulting object(s). IfTrue, the defaultrc['colorbar.loc']='right'is used. If the same location is used in successive plotting calls, object(s) will be added to the existing colorbar in that location (valid for colorbars built from lists of artists). Valid locations are shown in incolorbar.colorbar_kw (dict-like, optional) – Extra keyword args for the call to
colorbar.legend (
bool,int, orstr, optional) – Location specifying where to draw an inset or outer legend from the resulting object(s). IfTrue, the defaultrc['legend.loc']='best'is used. If the same location is used in successive plotting calls, object(s) will be added to existing legend in that location. Valid locations are shown inlegend().legend_kw (dict-like, optional) – Extra keyword args for the call to
legend.**kwargs – Passed to
hist.
See also
- hist2d(**kwargs)[source]
Plot a standard 2D histogram. standard 2D histogram.
- Parameters:
*args (
yorx,y) – The data passed as positional or keyword arguments. Interpreted as follows:If only
ycoordinates are passed, try to infer thexcoordinates from theSeriesorDataFrameindices or theDataArraycoordinates. Otherwise, thexcoordinates arenp.arange(0, y.shape[0]).If the
ycoordinates are a 2D array, plot each column of data in succession (except where each column of data represents a statistical distribution, as withboxplot,violinplot, or when usingmeans=Trueormedians=True).If any arguments are
pint.Quantity, auto-add the pint unit registry to matplotlib’s unit registry usingsetup_matplotlib. Apint.Quantityembedded in anxarray.DataArrayis also supported.
bins (
intor2-tupleofint, or array-like or2-tupleof array-like, optional) – The bin count or exact bin edges for each dimension or both dimensions.weights (array-like, optional) – The weights associated with each point. If string this can be retrieved from
data(see below).data (dict-like, optional) – A dict-like dataset container (e.g.,
DataFrameorDataset). If passed, each data argument can optionally be a stringkeyand the arrays used for plotting are retrieved withdata[key]. This is a native matplotlib feature.autoformat (
bool, default:rc.autoformat=True) – Whether thexaxis labels,yaxis labels, axis formatters, axes titles, legend titles, and colorbar labels are automatically configured when aSeries,DataFrame,DataArray, orQuantityis passed to the plotting command. Formatting ofpint.Quantityunit strings is controlled byrc.unitformat='L'.
- Other Parameters:
cmap (
colormap-spec, default:rc['cmap.sequential']='Fire'orrc['cmap.diverging']='BuRd') – The colormap specifer, passed to theColormapconstructor function. Ifrc['cmap.autodiverging']isTrueand the normalization range contains negative and positive values thenrc['cmap.diverging']is used. Otherwiserc['cmap.sequential']is used.c, color, colors (
color-specor sequence ofcolor-spec, optional) – The color(s) used to create aDiscreteColormap. If not passed,cmapis used.norm (
norm-spec, default:NormalizeorDivergingNorm) – The data value normalizer, passed to theNormconstructor function. IfdiscreteisTruethen 1) this affects the default level-generation algorithm (e.g.norm='log'builds levels in log-space) and 2) this is passed toDiscreteNormto scale the colors before they are discretized (ifnormis not already aDiscreteNorm). Ifrc['cmap.autodiverging']isTrueand the normalization range contains negative and positive values thenDivergingNormis used. OtherwiseNormalizeis used.extend (
{'neither', 'both', 'min', 'max'}, default:'neither') – Direction for drawing colorbar “extensions” indicating out-of-bounds data on the end of the colorbar.discrete (
bool, default:rc['cmap.discrete']=None) – IfFalse, thenDiscreteNormis not applied to the colormap. Instead, for non-contour plots, the number of levels will be roughly controlled byrc['cmap.lut']. This has a similar effect to usinglevels=large_numberbut it may improve rendering speed. Default isTrueonly for contouring commands likecontourfand pseudocolor commands likepcolor.sequential, diverging, cyclic, qualitative (
bool, default:None) – Boolean arguments used ifcmapis not passed. Set these toTrueto use the defaultrc['cmap.sequential'],rc['cmap.diverging'],rc['cmap.cyclic'], andrc['cmap.qualitative']colormaps. Thedivergingoption also appliesDivergingNormas the default continuous normalizer.vmin, vmax (
float, optional) – The minimum and maximum color scale values used with thenormnormalizer. IfdiscreteisFalsethese are the absolute limits, and ifdiscreteisTruethese are the approximate limits used to automatically determinelevelsorvalueslists at “nice” intervals. Iflevelsorvalueswere already passed as lists, these are ignored, andvminandvmaxare set to the minimum and maximum of the lists. Ifrobustwas passed, the defaultvminandvmaxare some percentile range of the data values. Otherwise, the defaultvminandvmaxare the minimum and maximum of the data values.N – Shorthand for
levels.levels (
intor sequence offloat, default:rc['cmap.levels']=11) – The number of level edges or a sequence of level edges. If the former,locatoris used to generate this many level edges at “nice” intervals. If the latter, the levels should be monotonically increasing or decreasing (note decreasing levels fail withcontourplots).values (
intor sequence offloat, default:None) – The number of level centers or a sequence of level centers. If the former,locatoris used to generate this many level centers at “nice” intervals. If the latter, levels are inferred usingedges. This will override anylevelsinput.center_levels (
bool, defaultFalse) – If set to true, the discrete color bar bins will be centered on the level values instead of using the level values as the edges of the discrete bins. This option can be used for diverging, discrete color bars with both positive and negative data to ensure data near zero is properly represented.robust (
bool,float, or2-tuple, default:rc['cmap.robust']=False) – IfTrueandvminorvmaxwere not provided, they are determined from the 2nd and 98th data percentiles rather than the minimum and maximum. If float, this percentile range is used (for example,90corresponds to the 5th to 95th percentiles). If 2-tuple of float, these specific percentiles should be used. This feature is useful when your data has large outliers.inbounds (
bool, default:rc['cmap.inbounds']=True) – IfTrueandvminorvmaxwere not provided, when axis limits have been explicitly restricted withset_xlim()orset_ylim(), out-of-bounds data is ignored. See alsorc['cmap.inbounds']andrc['axes.inbounds'].locator (
locator-spec, default:matplotlib.ticker.MaxNLocator) – The locator used to determine level locations iflevelsorvalueswere not already passed as lists. Passed to theLocatorconstructor. Default isMaxNLocatorwithlevelsinteger levels.locator_kw (dict-like, optional) – Keyword arguments passed to
matplotlib.ticker.Locatorclass.symmetric (
bool, default:False) – IfTrue, the normalization range or discrete colormap levels are symmetric about zero.positive (
bool, default:False) – IfTrue, the normalization range or discrete colormap levels are positive with a minimum at zero.negative (
bool, default:False) – IfTrue, the normaliation range or discrete colormap levels are negative with a minimum at zero.nozero (
bool, default:False) – IfTrue,0is removed from the level list. This is mainly useful for single-colorcontourplots.label (
str, optional) – The legend label to be used for this object. In the case of contours, this is paired with the the central artist in the artist list returned bymatplotlib.contour.ContourSet.legend_elements.labels (
bool, optional) – Whether to apply labels to contours and grid boxes. The text will be white when the luminance of the underlying filled contour or grid box is less than 50 and black otherwise.labels_kw (dict-like, optional) – Ignored if
labelsisFalse. Extra keyword args for the labels. For contour plots, this is passed toclabel. Otherwise, this is passed totext.formatter, fmt (
formatter-spec, optional) – TheFormatterused to format number labels. Passed to theFormatterconstructor.formatter_kw (dict-like, optional) – Keyword arguments passed to
matplotlib.ticker.Formatterclass.precision (
int, optional) – The maximum number of decimal places for number labels generated with the default formatterSimpleformatter.colorbar (
bool,int, orstr, optional) – If notNone, this is a location specifying where to draw an inset or outer colorbar from the resulting object(s). IfTrue, the defaultrc['colorbar.loc']='right'is used. If the same location is used in successive plotting calls, object(s) will be added to the existing colorbar in that location (valid for colorbars built from lists of artists). Valid locations are shown in incolorbar.colorbar_kw (dict-like, optional) – Extra keyword args for the call to
colorbar.legend (
bool,int, orstr, optional) – Location specifying where to draw an inset or outer legend from the resulting object(s). IfTrue, the defaultrc['legend.loc']='best'is used. If the same location is used in successive plotting calls, object(s) will be added to existing legend in that location. Valid locations are shown inlegend().legend_kw (dict-like, optional) – Extra keyword args for the call to
legend.**kwargs – Passed to
hist2d.
- histh(*args, **kwargs)[source]
Plot horizontal histograms.
- Parameters:
*args (
xory,x) – The data passed as positional or keyword arguments. Interpreted as follows:If only
xcoordinates are passed, try to infer theycoordinates from theSeriesorDataFrameindices or theDataArraycoordinates. Otherwise, theycoordinates arenp.arange(0, x.shape[0]).If the
xcoordinates are a 2D array, plot each column of data in succession (except where each column of data represents a statistical distribution, as withboxplot,violinplot, or when usingmeans=Trueormedians=True).If any arguments are
pint.Quantity, auto-add the pint unit registry to matplotlib’s unit registry usingsetup_matplotlib. Apint.Quantityembedded in anxarray.DataArrayis also supported.
bins (
intor sequence offloat, optional) – The bin count or exact bin edges.weights (array-like, optional) – The weights associated with each point. If string this can be retrieved from
data(see below).histtype (
{'bar', 'barstacked', 'step', 'stepfilled'}, optional) – The histogram type. Seematplotlib.axes.Axes.histfor details.width, rwidth (
float, default:0.8or1) – The bar width(s) for bar-type histograms relative to the bin size. Default is0.8for multiple columns of unstacked data and1otherwise.stack, stacked (
bool, optional) – Whether to “stack” successive columns of x data for bar-type histograms or show side-by-side in groups. Setting this toFalseis equivalent tohisttype='bar'and toTrueis equivalent tohisttype='barstacked'.fill, filled (
bool, optional) – Whether to “fill” step-type histograms or just plot the edges. Setting this toFalseis equivalent tohisttype='step'and toTrueis equivalent tohisttype='stepfilled'.data (dict-like, optional) – A dict-like dataset container (e.g.,
DataFrameorDataset). If passed, each data argument can optionally be a stringkeyand the arrays used for plotting are retrieved withdata[key]. This is a native matplotlib feature.autoformat (
bool, default:rc.autoformat=True) – Whether thexaxis labels,yaxis labels, axis formatters, axes titles, legend titles, and colorbar labels are automatically configured when aSeries,DataFrame,DataArray, orQuantityis passed to the plotting command. Formatting ofpint.Quantityunit strings is controlled byrc.unitformat='L'.
- Other Parameters:
cycle (
cycle-spec, optional) – The cycle specifer, passed to theCycleconstructor. If the returned cycler is unchanged from the current cycler, the axes cycler will not be reset to its first position. To disable property cycling and just use black for the default color, usecycle=False,cycle='none', orcycle=()(analogous to disabling ticks with e.g.xformatter='none'). To restore the default property cycler, usecycle=True.lw, linewidth, linewidths (
unit-spec, default:rc['patch.linewidth']=0.6) – The edge width of the patch(es). If float, units are points. If string, interpreted byunits.ls, linestyle, linestyles (
str, default:'-') – The edge style of the patch(es).ec, edgecolor, edgecolors (
color-spec, default:'none') – The edge color of the patch(es).fc, facecolor, facecolors, fillcolor, fillcolors (
color-spec, optional) – The face color of the patch(es). The propertycycleis used by default.a, alpha, alphas (
float, optional) – The opacity of the patch(es). Inferred fromfacecolorandedgecolorby default.edgefix (
boolorfloat, default:rc.edgefix=True) – Whether to fix the common issue where white lines appear between adjacent patches in saved vector graphics (this can slow down figure rendering). See this github repo for a demonstration of the problem. IfTrue, a small default linewidth of0.3is used to cover up the white lines. If float (e.g.edgefix=0.5), this specific linewidth is used to cover up the white lines. This feature is automatically disabled when the patches have transparency.label, value (
floatorstr, optional) – The single legend label or colorbar coordinate to be used for this plotted element. Can be numeric or string. This is generally used with 1D positional arguments.labels, values (sequence of
floator sequence ofstr, optional) – The legend labels or colorbar coordinates used for each plotted element. Can be numeric or string, and must match the number of plotted elements. This is generally used with 2D positional arguments.colorbar (
bool,int, orstr, optional) – If notNone, this is a location specifying where to draw an inset or outer colorbar from the resulting object(s). IfTrue, the defaultrc['colorbar.loc']='right'is used. If the same location is used in successive plotting calls, object(s) will be added to the existing colorbar in that location (valid for colorbars built from lists of artists). Valid locations are shown in incolorbar.colorbar_kw (dict-like, optional) – Extra keyword args for the call to
colorbar.legend (
bool,int, orstr, optional) – Location specifying where to draw an inset or outer legend from the resulting object(s). IfTrue, the defaultrc['legend.loc']='best'is used. If the same location is used in successive plotting calls, object(s) will be added to existing legend in that location. Valid locations are shown inlegend().legend_kw (dict-like, optional) – Extra keyword args for the call to
legend.**kwargs – Passed to
hist.
See also
- hlines(*args, **kwargs)[source]
Plot horizontal lines.
- Parameters:
*args (
x2ory,x2, ory,x1,x2) – The data passed as positional or keyword arguments. Interpreted as follows:If only
xcoordinates are passed, try to infer theycoordinates from theSeriesorDataFrameindices or theDataArraycoordinates. Otherwise, theycoordinates arenp.arange(0, x2.shape[0]).If only
yandx2coordinates are passed, set thex1coordinates to zero. This draws elements originating from the zero line.If both
x1andx2are provided, draw elements between these points. If either are 2D, draw elements by iterating over each column.If any arguments are
pint.Quantity, auto-add the pint unit registry to matplotlib’s unit registry usingsetup_matplotlib. Apint.Quantityembedded in anxarray.DataArrayis also supported.
data (dict-like, optional) – A dict-like dataset container (e.g.,
DataFrameorDataset). If passed, each data argument can optionally be a stringkeyand the arrays used for plotting are retrieved withdata[key]. This is a native matplotlib feature.autoformat (
bool, default:rc.autoformat=True) – Whether thexaxis labels,yaxis labels, axis formatters, axes titles, legend titles, and colorbar labels are automatically configured when aSeries,DataFrame,DataArray, orQuantityis passed to the plotting command. Formatting ofpint.Quantityunit strings is controlled byrc.unitformat='L'.
- Other Parameters:
stack, stacked (
bool, default:False) – Whether to “stack” lines from successive columns of x data or plot lines on top of each other.cycle (
cycle-spec, optional) – The cycle specifer, passed to theCycleconstructor. If the returned cycler is unchanged from the current cycler, the axes cycler will not be reset to its first position. To disable property cycling and just use black for the default color, usecycle=False,cycle='none', orcycle=()(analogous to disabling ticks with e.g.xformatter='none'). To restore the default property cycler, usecycle=True.lw, linewidth, linewidths (
unit-spec, default:rc['lines.linewidth']=1.5) – The width of the line(s). If float, units are points. If string, interpreted byunits.ls, linestyle, linestyles (
str, default:rc['lines.linestyle']='-') – The style of the line(s).c, color, colors (
color-spec, optional) – The color of the line(s). The propertycycleis used by default.a, alpha, alphas (
float, optional) – The opacity of the line(s). Inferred fromcolorby default.negpos (
bool, default:False) – Whether to shade lines whereymax >= yminwithposcolorand whereymax < yminwithnegcolor. IfTruethis function will return a length-2 silent list of handles.negcolor, poscolor (
color-spec, default:rc.negcolor='blue7',rc.poscolor='red7') – Colors to use for the negative and positive lines. Ignored ifnegposisFalse.inbounds (
bool, default:rc['axes.inbounds']=True) – Whether to restrict the defaulty(x) axis limits to account for only in-bounds data when thex(y) axis limits have been locked. See alsorc['axes.inbounds']andrc['cmap.inbounds'].label, value (
floatorstr, optional) – The single legend label or colorbar coordinate to be used for this plotted element. Can be numeric or string. This is generally used with 1D positional arguments.labels, values (sequence of
floator sequence ofstr, optional) – The legend labels or colorbar coordinates used for each plotted element. Can be numeric or string, and must match the number of plotted elements. This is generally used with 2D positional arguments.colorbar (
bool,int, orstr, optional) – If notNone, this is a location specifying where to draw an inset or outer colorbar from the resulting object(s). IfTrue, the defaultrc['colorbar.loc']='right'is used. If the same location is used in successive plotting calls, object(s) will be added to the existing colorbar in that location (valid for colorbars built from lists of artists). Valid locations are shown in incolorbar.colorbar_kw (dict-like, optional) – Extra keyword args for the call to
colorbar.legend (
bool,int, orstr, optional) – Location specifying where to draw an inset or outer legend from the resulting object(s). IfTrue, the defaultrc['legend.loc']='best'is used. If the same location is used in successive plotting calls, object(s) will be added to existing legend in that location. Valid locations are shown inlegend().legend_kw (dict-like, optional) – Extra keyword args for the call to
legend.**kwargs – Passed to
hlines.
- imshow(**kwargs)[source]
Plot an image.
- Parameters:
z (array-like) – The data passed as a positional argument or keyword argument.
data (dict-like, optional) – A dict-like dataset container (e.g.,
DataFrameorDataset). If passed, each data argument can optionally be a stringkeyand the arrays used for plotting are retrieved withdata[key]. This is a native matplotlib feature.autoformat (
bool, default:rc.autoformat=True) – Whether thexaxis labels,yaxis labels, axis formatters, axes titles, legend titles, and colorbar labels are automatically configured when aSeries,DataFrame,DataArray, orQuantityis passed to the plotting command. Formatting ofpint.Quantityunit strings is controlled byrc.unitformat='L'.
- Other Parameters:
cmap (
colormap-spec, default:rc['cmap.sequential']='Fire'orrc['cmap.diverging']='BuRd') – The colormap specifer, passed to theColormapconstructor function. Ifrc['cmap.autodiverging']isTrueand the normalization range contains negative and positive values thenrc['cmap.diverging']is used. Otherwiserc['cmap.sequential']is used.c, color, colors (
color-specor sequence ofcolor-spec, optional) – The color(s) used to create aDiscreteColormap. If not passed,cmapis used.norm (
norm-spec, default:NormalizeorDivergingNorm) – The data value normalizer, passed to theNormconstructor function. IfdiscreteisTruethen 1) this affects the default level-generation algorithm (e.g.norm='log'builds levels in log-space) and 2) this is passed toDiscreteNormto scale the colors before they are discretized (ifnormis not already aDiscreteNorm). Ifrc['cmap.autodiverging']isTrueand the normalization range contains negative and positive values thenDivergingNormis used. OtherwiseNormalizeis used.extend (
{'neither', 'both', 'min', 'max'}, default:'neither') – Direction for drawing colorbar “extensions” indicating out-of-bounds data on the end of the colorbar.discrete (
bool, default:rc['cmap.discrete']=None) – IfFalse, thenDiscreteNormis not applied to the colormap. Instead, for non-contour plots, the number of levels will be roughly controlled byrc['cmap.lut']. This has a similar effect to usinglevels=large_numberbut it may improve rendering speed. Default isTrueonly for contouring commands likecontourfand pseudocolor commands likepcolor.sequential, diverging, cyclic, qualitative (
bool, default:None) – Boolean arguments used ifcmapis not passed. Set these toTrueto use the defaultrc['cmap.sequential'],rc['cmap.diverging'],rc['cmap.cyclic'], andrc['cmap.qualitative']colormaps. Thedivergingoption also appliesDivergingNormas the default continuous normalizer.vmin, vmax (
float, optional) – The minimum and maximum color scale values used with thenormnormalizer. IfdiscreteisFalsethese are the absolute limits, and ifdiscreteisTruethese are the approximate limits used to automatically determinelevelsorvalueslists at “nice” intervals. Iflevelsorvalueswere already passed as lists, these are ignored, andvminandvmaxare set to the minimum and maximum of the lists. Ifrobustwas passed, the defaultvminandvmaxare some percentile range of the data values. Otherwise, the defaultvminandvmaxare the minimum and maximum of the data values.N – Shorthand for
levels.levels (
intor sequence offloat, default:rc['cmap.levels']=11) – The number of level edges or a sequence of level edges. If the former,locatoris used to generate this many level edges at “nice” intervals. If the latter, the levels should be monotonically increasing or decreasing (note decreasing levels fail withcontourplots).values (
intor sequence offloat, default:None) – The number of level centers or a sequence of level centers. If the former,locatoris used to generate this many level centers at “nice” intervals. If the latter, levels are inferred usingedges. This will override anylevelsinput.center_levels (
bool, defaultFalse) – If set to true, the discrete color bar bins will be centered on the level values instead of using the level values as the edges of the discrete bins. This option can be used for diverging, discrete color bars with both positive and negative data to ensure data near zero is properly represented.robust (
bool,float, or2-tuple, default:rc['cmap.robust']=False) – IfTrueandvminorvmaxwere not provided, they are determined from the 2nd and 98th data percentiles rather than the minimum and maximum. If float, this percentile range is used (for example,90corresponds to the 5th to 95th percentiles). If 2-tuple of float, these specific percentiles should be used. This feature is useful when your data has large outliers.inbounds (
bool, default:rc['cmap.inbounds']=True) – IfTrueandvminorvmaxwere not provided, when axis limits have been explicitly restricted withset_xlim()orset_ylim(), out-of-bounds data is ignored. See alsorc['cmap.inbounds']andrc['axes.inbounds'].locator (
locator-spec, default:matplotlib.ticker.MaxNLocator) – The locator used to determine level locations iflevelsorvalueswere not already passed as lists. Passed to theLocatorconstructor. Default isMaxNLocatorwithlevelsinteger levels.locator_kw (dict-like, optional) – Keyword arguments passed to
matplotlib.ticker.Locatorclass.symmetric (
bool, default:False) – IfTrue, the normalization range or discrete colormap levels are symmetric about zero.positive (
bool, default:False) – IfTrue, the normalization range or discrete colormap levels are positive with a minimum at zero.negative (
bool, default:False) – IfTrue, the normaliation range or discrete colormap levels are negative with a minimum at zero.nozero (
bool, default:False) – IfTrue,0is removed from the level list. This is mainly useful for single-colorcontourplots.colorbar (
bool,int, orstr, optional) – If notNone, this is a location specifying where to draw an inset or outer colorbar from the resulting object(s). IfTrue, the defaultrc['colorbar.loc']='right'is used. If the same location is used in successive plotting calls, object(s) will be added to the existing colorbar in that location (valid for colorbars built from lists of artists). Valid locations are shown in incolorbar.colorbar_kw (dict-like, optional) – Extra keyword args for the call to
colorbar.legend (
bool,int, orstr, optional) – Location specifying where to draw an inset or outer legend from the resulting object(s). IfTrue, the defaultrc['legend.loc']='best'is used. If the same location is used in successive plotting calls, object(s) will be added to existing legend in that location. Valid locations are shown inlegend().legend_kw (dict-like, optional) – Extra keyword args for the call to
legend.**kwargs – Passed to
matplotlib.axes.Axes.imshow.
- line(*args, **kwargs)[source]
Plot standard lines.
- Parameters:
*args (
yorx,y) – The data passed as positional or keyword arguments. Interpreted as follows:If only
ycoordinates are passed, try to infer thexcoordinates from theSeriesorDataFrameindices or theDataArraycoordinates. Otherwise, thexcoordinates arenp.arange(0, y.shape[0]).If the
ycoordinates are a 2D array, plot each column of data in succession (except where each column of data represents a statistical distribution, as withboxplot,violinplot, or when usingmeans=Trueormedians=True).If any arguments are
pint.Quantity, auto-add the pint unit registry to matplotlib’s unit registry usingsetup_matplotlib. Apint.Quantityembedded in anxarray.DataArrayis also supported.
data (dict-like, optional) – A dict-like dataset container (e.g.,
DataFrameorDataset). If passed, each data argument can optionally be a stringkeyand the arrays used for plotting are retrieved withdata[key]. This is a native matplotlib feature.autoformat (
bool, default:rc.autoformat=True) – Whether thexaxis labels,yaxis labels, axis formatters, axes titles, legend titles, and colorbar labels are automatically configured when aSeries,DataFrame,DataArray, orQuantityis passed to the plotting command. Formatting ofpint.Quantityunit strings is controlled byrc.unitformat='L'.
- Other Parameters:
cycle (
cycle-spec, optional) – The cycle specifer, passed to theCycleconstructor. If the returned cycler is unchanged from the current cycler, the axes cycler will not be reset to its first position. To disable property cycling and just use black for the default color, usecycle=False,cycle='none', orcycle=()(analogous to disabling ticks with e.g.xformatter='none'). To restore the default property cycler, usecycle=True.lw, linewidth, linewidths (
unit-spec, default:rc['lines.linewidth']=1.5) – The width of the line(s). If float, units are points. If string, interpreted byunits.ls, linestyle, linestyles (
str, default:rc['lines.linestyle']='-') – The style of the line(s).c, color, colors (
color-spec, optional) – The color of the line(s). The propertycycleis used by default.a, alpha, alphas (
float, optional) – The opacity of the line(s). Inferred fromcolorby default.mean, means (
bool, default:False) – Whether to plot the means of each column for 2Dycoordinates. Means are calculated withnumpy.nanmean. If no other arguments are specified, this also setsbarstd=True(andboxstd=Truefor violin plots).median, medians (
bool, default:False) – Whether to plot the medians of each column for 2Dycoordinates. Medians are calculated withnumpy.nanmedian. If no other arguments arguments are specified, this also setsbarstd=True(andboxstd=Truefor violin plots).barstd, barstds (
bool,float, or2-tupleoffloat, optional) – Valid only ifmeanormedianisTrue. Standard deviation multiples for thin error bars with optional whiskers (i.e., caps). If scalar, then +/- that multiple is used. IfTrue, the default standard deviation range of +/-3 is used.barpctile, barpctiles (
bool,float, or2-tupleoffloat, optional) – Valid only ifmeanormedianisTrue. As withbarstd, but instead using percentiles for the error bars. If scalar, that percentile range is used (e.g.,90shows the 5th to 95th percentiles). IfTrue, the default percentile range of 0 to 100 is used.bardata (array-like, optional) – Valid only if
meanandmedianareFalse. If shape is 2 x N, these are the lower and upper bounds for the thin error bars. If shape is N, these are the absolute, symmetric deviations from the central points.boxes (
bool, default:None) – Shorthand forboxstd,boxstds.boxstd, boxstds, boxpctile, boxpctiles, boxdata (optional) – As with
barstd,barpctile, andbardata, but for thicker error bars representing a smaller interval than the thin error bars. IfboxstdsisTrue, the default standard deviation range of +/-1 is used. IfboxpctilesisTrue, the default percentile range of 25 to 75 is used (i.e., the interquartile range). When “boxes” and “bars” are combined, this has the effect of drawing miniature box-and-whisker plots.capsize (
float, default:rc['errorbar.capsize']=3.0) – The cap size for thin error bars in points.barz, barzorder, boxz, boxzorder (
float, default:2.5) – The “zorder” for the thin and thick error bars.barc, barcolor, boxc, boxcolor (
color-spec, default:rc['boxplot.whiskerprops.color']='black') – Colors for the thin and thick error bars.barlw, barlinewidth, boxlw, boxlinewidth (
float, default:rc['boxplot.whiskerprops.linewidth']=1.0) – Line widths for the thin and thick error bars, in points. The default for boxes is 4 timesrc['boxplot.whiskerprops.linewidth'].boxm, boxmarker (
boolormarker-spec, default:'o') – Whether to draw a small marker in the middle of the box denoting the mean or median position. Ignored ifboxesisFalse.boxms, boxmarkersize (
size-spec, default:(2 * boxlinewidth) ** 2) – The marker size for theboxmarkermarker in points ** 2.boxmc, boxmarkercolor, boxmec, boxmarkeredgecolor (
color-spec, default:'w') – Color, face color, and edge color for theboxmarkermarker.shadestd, shadestds, shadepctile, shadepctiles, shadedata (optional) – As with
barstd,barpctile, andbardata, but using shading to indicate the error range. IfshadestdsisTrue, the default standard deviation range of +/-2 is used. IfshadepctilesisTrue, the default percentile range of 10 to 90 is used.fadestd, fadestds, fadepctile, fadepctiles, fadedata (optional) – As with
shadestd,shadepctile, andshadedata, but for an additional, more faded, secondary shaded region. IffadestdsisTrue, the default standard deviation range of +/-3 is used. IffadepctilesisTrue, the default percentile range of 0 to 100 is used.shadec, shadecolor, fadec, fadecolor (
color-spec, default:None) – Colors for the different shaded regions. The parent artist color is used by default.shadez, shadezorder, fadez, fadezorder (
float, default:1.5) – The “zorder” for the different shaded regions.shadea, shadealpha, fadea, fadealpha (
float, default:0.4,0.2) – The opacity for the different shaded regions.shadelw, shadelinewidth, fadelw, fadelinewidth (
float, default:rc['patch.linewidth']=0.6.) – The edge line width for the shading patches.shdeec, shadeedgecolor, fadeec, fadeedgecolor (
float, default:'none') – The edge color for the shading patches.shadelabel, fadelabel (
boolorstr, optional) – Labels for the shaded regions to be used as separate legend entries. To toggle labels “on” and apply a default label, use e.g.shadelabel=True. To apply a custom label, use e.g.shadelabel='label'. Otherwise, the shading is drawn underneath the line and/or marker in the legend entry.inbounds (
bool, default:rc['axes.inbounds']=True) – Whether to restrict the defaulty(x) axis limits to account for only in-bounds data when thex(y) axis limits have been locked. See alsorc['axes.inbounds']andrc['cmap.inbounds'].label, value (
floatorstr, optional) – The single legend label or colorbar coordinate to be used for this plotted element. Can be numeric or string. This is generally used with 1D positional arguments.labels, values (sequence of
floator sequence ofstr, optional) – The legend labels or colorbar coordinates used for each plotted element. Can be numeric or string, and must match the number of plotted elements. This is generally used with 2D positional arguments.colorbar (
bool,int, orstr, optional) – If notNone, this is a location specifying where to draw an inset or outer colorbar from the resulting object(s). IfTrue, the defaultrc['colorbar.loc']='right'is used. If the same location is used in successive plotting calls, object(s) will be added to the existing colorbar in that location (valid for colorbars built from lists of artists). Valid locations are shown in incolorbar.colorbar_kw (dict-like, optional) – Extra keyword args for the call to
colorbar.legend (
bool,int, orstr, optional) – Location specifying where to draw an inset or outer legend from the resulting object(s). IfTrue, the defaultrc['legend.loc']='best'is used. If the same location is used in successive plotting calls, object(s) will be added to existing legend in that location. Valid locations are shown inlegend().legend_kw (dict-like, optional) – Extra keyword args for the call to
legend.**kwargs – Passed to
plot().
See also
- linex(*args, **kwargs)[source]
Plot standard lines.
- Parameters:
*args (
xory,x) – The data passed as positional or keyword arguments. Interpreted as follows:If only
xcoordinates are passed, try to infer theycoordinates from theSeriesorDataFrameindices or theDataArraycoordinates. Otherwise, theycoordinates arenp.arange(0, x.shape[0]).If the
xcoordinates are a 2D array, plot each column of data in succession (except where each column of data represents a statistical distribution, as withboxplot,violinplot, or when usingmeans=Trueormedians=True).If any arguments are
pint.Quantity, auto-add the pint unit registry to matplotlib’s unit registry usingsetup_matplotlib. Apint.Quantityembedded in anxarray.DataArrayis also supported.
data (dict-like, optional) – A dict-like dataset container (e.g.,
DataFrameorDataset). If passed, each data argument can optionally be a stringkeyand the arrays used for plotting are retrieved withdata[key]. This is a native matplotlib feature.autoformat (
bool, default:rc.autoformat=True) – Whether thexaxis labels,yaxis labels, axis formatters, axes titles, legend titles, and colorbar labels are automatically configured when aSeries,DataFrame,DataArray, orQuantityis passed to the plotting command. Formatting ofpint.Quantityunit strings is controlled byrc.unitformat='L'.
- Other Parameters:
cycle (
cycle-spec, optional) – The cycle specifer, passed to theCycleconstructor. If the returned cycler is unchanged from the current cycler, the axes cycler will not be reset to its first position. To disable property cycling and just use black for the default color, usecycle=False,cycle='none', orcycle=()(analogous to disabling ticks with e.g.xformatter='none'). To restore the default property cycler, usecycle=True.lw, linewidth, linewidths (
unit-spec, default:rc['lines.linewidth']=1.5) – The width of the line(s). If float, units are points. If string, interpreted byunits.ls, linestyle, linestyles (
str, default:rc['lines.linestyle']='-') – The style of the line(s).c, color, colors (
color-spec, optional) – The color of the line(s). The propertycycleis used by default.a, alpha, alphas (
float, optional) – The opacity of the line(s). Inferred fromcolorby default.mean, means (
bool, default:False) – Whether to plot the means of each column for 2Dxcoordinates. Means are calculated withnumpy.nanmean. If no other arguments are specified, this also setsbarstd=True(andboxstd=Truefor violin plots).median, medians (
bool, default:False) – Whether to plot the medians of each column for 2Dxcoordinates. Medians are calculated withnumpy.nanmedian. If no other arguments arguments are specified, this also setsbarstd=True(andboxstd=Truefor violin plots).barstd, barstds (
bool,float, or2-tupleoffloat, optional) – Valid only ifmeanormedianisTrue. Standard deviation multiples for thin error bars with optional whiskers (i.e., caps). If scalar, then +/- that multiple is used. IfTrue, the default standard deviation range of +/-3 is used.barpctile, barpctiles (
bool,float, or2-tupleoffloat, optional) – Valid only ifmeanormedianisTrue. As withbarstd, but instead using percentiles for the error bars. If scalar, that percentile range is used (e.g.,90shows the 5th to 95th percentiles). IfTrue, the default percentile range of 0 to 100 is used.bardata (array-like, optional) – Valid only if
meanandmedianareFalse. If shape is 2 x N, these are the lower and upper bounds for the thin error bars. If shape is N, these are the absolute, symmetric deviations from the central points.boxes (
bool, default:None) – Shorthand forboxstd,boxstds.boxstd, boxstds, boxpctile, boxpctiles, boxdata (optional) – As with
barstd,barpctile, andbardata, but for thicker error bars representing a smaller interval than the thin error bars. IfboxstdsisTrue, the default standard deviation range of +/-1 is used. IfboxpctilesisTrue, the default percentile range of 25 to 75 is used (i.e., the interquartile range). When “boxes” and “bars” are combined, this has the effect of drawing miniature box-and-whisker plots.capsize (
float, default:rc['errorbar.capsize']=3.0) – The cap size for thin error bars in points.barz, barzorder, boxz, boxzorder (
float, default:2.5) – The “zorder” for the thin and thick error bars.barc, barcolor, boxc, boxcolor (
color-spec, default:rc['boxplot.whiskerprops.color']='black') – Colors for the thin and thick error bars.barlw, barlinewidth, boxlw, boxlinewidth (
float, default:rc['boxplot.whiskerprops.linewidth']=1.0) – Line widths for the thin and thick error bars, in points. The default for boxes is 4 timesrc['boxplot.whiskerprops.linewidth'].boxm, boxmarker (
boolormarker-spec, default:'o') – Whether to draw a small marker in the middle of the box denoting the mean or median position. Ignored ifboxesisFalse.boxms, boxmarkersize (
size-spec, default:(2 * boxlinewidth) ** 2) – The marker size for theboxmarkermarker in points ** 2.boxmc, boxmarkercolor, boxmec, boxmarkeredgecolor (
color-spec, default:'w') – Color, face color, and edge color for theboxmarkermarker.shadestd, shadestds, shadepctile, shadepctiles, shadedata (optional) – As with
barstd,barpctile, andbardata, but using shading to indicate the error range. IfshadestdsisTrue, the default standard deviation range of +/-2 is used. IfshadepctilesisTrue, the default percentile range of 10 to 90 is used.fadestd, fadestds, fadepctile, fadepctiles, fadedata (optional) – As with
shadestd,shadepctile, andshadedata, but for an additional, more faded, secondary shaded region. IffadestdsisTrue, the default standard deviation range of +/-3 is used. IffadepctilesisTrue, the default percentile range of 0 to 100 is used.shadec, shadecolor, fadec, fadecolor (
color-spec, default:None) – Colors for the different shaded regions. The parent artist color is used by default.shadez, shadezorder, fadez, fadezorder (
float, default:1.5) – The “zorder” for the different shaded regions.shadea, shadealpha, fadea, fadealpha (
float, default:0.4,0.2) – The opacity for the different shaded regions.shadelw, shadelinewidth, fadelw, fadelinewidth (
float, default:rc['patch.linewidth']=0.6.) – The edge line width for the shading patches.shdeec, shadeedgecolor, fadeec, fadeedgecolor (
float, default:'none') – The edge color for the shading patches.shadelabel, fadelabel (
boolorstr, optional) – Labels for the shaded regions to be used as separate legend entries. To toggle labels “on” and apply a default label, use e.g.shadelabel=True. To apply a custom label, use e.g.shadelabel='label'. Otherwise, the shading is drawn underneath the line and/or marker in the legend entry.inbounds (
bool, default:rc['axes.inbounds']=True) – Whether to restrict the defaulty(x) axis limits to account for only in-bounds data when thex(y) axis limits have been locked. See alsorc['axes.inbounds']andrc['cmap.inbounds'].label, value (
floatorstr, optional) – The single legend label or colorbar coordinate to be used for this plotted element. Can be numeric or string. This is generally used with 1D positional arguments.labels, values (sequence of
floator sequence ofstr, optional) – The legend labels or colorbar coordinates used for each plotted element. Can be numeric or string, and must match the number of plotted elements. This is generally used with 2D positional arguments.colorbar (
bool,int, orstr, optional) – If notNone, this is a location specifying where to draw an inset or outer colorbar from the resulting object(s). IfTrue, the defaultrc['colorbar.loc']='right'is used. If the same location is used in successive plotting calls, object(s) will be added to the existing colorbar in that location (valid for colorbars built from lists of artists). Valid locations are shown in incolorbar.colorbar_kw (dict-like, optional) – Extra keyword args for the call to
colorbar.legend (
bool,int, orstr, optional) – Location specifying where to draw an inset or outer legend from the resulting object(s). IfTrue, the defaultrc['legend.loc']='best'is used. If the same location is used in successive plotting calls, object(s) will be added to existing legend in that location. Valid locations are shown inlegend().legend_kw (dict-like, optional) – Extra keyword args for the call to
legend.**kwargs – Passed to
plot().
See also
- loglog(*args, **kwargs)[source]
Plot loglog
UltraPlot is optimized for visualizing logarithmic scales by default. For cases with large differences in magnitude, we recommend setting
rc["formatter.log"] = Trueto enhance axis label formatting. Make a plot with log scaling on both the x- and y-axis.Call signatures:
loglog([x], y, [fmt], data=None, **kwargs) loglog([x], y, [fmt], [x2], y2, [fmt2], ..., **kwargs)
This is just a thin wrapper around
plotwhich additionally changes both the x-axis and the y-axis to log scaling. All the concepts and parameters of plot can be used here as well.The additional parameters base, subs and nonpositive control the x/y-axis properties. They are just forwarded to
Axes.set_xscaleandAxes.set_yscale. To use different properties on the x-axis and the y-axis, use e.g.ax.set_xscale("log", base=10); ax.set_yscale("log", base=2).- Parameters:
base (
float, default:10) – Base of the logarithm.subs (sequence, optional) – The location of the minor ticks. If None, reasonable locations are automatically chosen depending on the number of decades in the plot. See
Axes.set_xscale/Axes.set_yscalefor details.nonpositive (
{'mask', 'clip'}, default:'clip') – Non-positive values can be masked as invalid, or clipped to a very small positive number.**kwargs – All parameters supported by
plot.
- Returns:
listofLine2D– Objects representing the plotted data.
Notes
Note
This is the pyplot wrapper for
axes.Axes.loglog.
- lollipop(*args, **kwargs)[source]
Plot individual or group lollipop graphs.
A lollipop graph is a bar graph with the bars replaced by dots connected to the x-axis by lines.
Inputs such as arrays (
xory) or dataframes (pandasorxarray) are passed throughbar(). Colors are inferred from the bar objects and parsed automatically. Formatting of the lollipop consists of controlling thestemand themarker. The stem properties can be set for the width, size, or color. Marker formatting follows the same inputs toscatter().- Parameters:
*args (
xory,x) – The data passed as positional or keyword arguments. Interpreted as follows:If only
xcoordinates are passed, try to infer theycoordinates from theSeriesorDataFrameindices or theDataArraycoordinates. Otherwise, theycoordinates arenp.arange(0, x.shape[0]).If the
xcoordinates are a 2D array, plot each column of data in succession (except where each column of data represents a statistical distribution, as withboxplot,violinplot, or when usingmeans=Trueormedians=True).If any arguments are
pint.Quantity, auto-add the pint unit registry to matplotlib’s unit registry usingsetup_matplotlib. Apint.Quantityembedded in anxarray.DataArrayis also supported.
stemlinewdith (
str, default :py:class:rc[`”lollipop.stemlinewidth”:py:class:`])stemcolor (
str, default :py:class:rc[`”lollipop.stemcolor”:py:class:`]) – Line color of the lines connecting the dots to the x-axis. Defaults torc["lollipop.linecolor"].stemlinestyle (
str, default: :py:class:rc[`”lollipop.stemlinestyle”:py:class:`]) – The style of the lines connecting the dots to the x-axis. Defaults torc["lollipop.linestyle"].s, size, ms, markersize (
floator array-like orunit-spec, optional) – The marker size area(s). If this is an array matching the shape ofxandy, the units are scaled bysminandsmax. If this contains unit string(s), it is processed byunitsand represents the width rather than area.c, color, colors, mc, markercolor, markercolors, fc, facecolor, facecolors (array-like or
color-spec, optional) – The marker color(s). If this is an array matching the shape ofxandy, the colors are generated usingcmap,norm,vmin, andvmax. Otherwise, this should be a valid matplotlib color.smin, smax (
float, optional) – The minimum and maximum marker size area in unitspoints ** 2. Ignored ifabsolute_sizeisTrue. Default value forsminis1and forsmaxis the square ofrc['lines.markersize']=6.0.area_size (
bool, default:True) – Whether the marker sizessare scaled by area or by radius. The defaultTrueis consistent with matplotlib. Whenabsolute_sizeisTrue, thesunits arepoints ** 2ifarea_sizeisTrueandpointsifarea_sizeisFalse.absolute_size (
bool, default:TrueorFalse) – Whethersshould be taken to represent “absolute” marker sizes in unitspointsorpoints ** 2or “relative” marker sizes scaled bysminandsmax. Default isTrueifsis scalar andFalseifsis array-like orsminorsmaxwere passed.vmin, vmax (
float, optional) – The minimum and maximum color scale values used with thenormnormalizer. IfdiscreteisFalsethese are the absolute limits, and ifdiscreteisTruethese are the approximate limits used to automatically determinelevelsorvalueslists at “nice” intervals. Iflevelsorvalueswere already passed as lists, these are ignored, andvminandvmaxare set to the minimum and maximum of the lists. Ifrobustwas passed, the defaultvminandvmaxare some percentile range of the data values. Otherwise, the defaultvminandvmaxare the minimum and maximum of the data values.data (dict-like, optional) – A dict-like dataset container (e.g.,
DataFrameorDataset). If passed, each data argument can optionally be a stringkeyand the arrays used for plotting are retrieved withdata[key]. This is a native matplotlib feature.autoformat (
bool, default:rc.autoformat=True) – Whether thexaxis labels,yaxis labels, axis formatters, axes titles, legend titles, and colorbar labels are automatically configured when aSeries,DataFrame,DataArray, orQuantityis passed to the plotting command. Formatting ofpint.Quantityunit strings is controlled byrc.unitformat='L'.
- Other Parameters:
cmap (
colormap-spec, default:rc['cmap.sequential']='Fire'orrc['cmap.diverging']='BuRd') – The colormap specifer, passed to theColormapconstructor function. Ifrc['cmap.autodiverging']isTrueand the normalization range contains negative and positive values thenrc['cmap.diverging']is used. Otherwiserc['cmap.sequential']is used.c, color, colors (
color-specor sequence ofcolor-spec, optional) – The color(s) used to create aDiscreteColormap. If not passed,cmapis used.norm (
norm-spec, default:NormalizeorDivergingNorm) – The data value normalizer, passed to theNormconstructor function. IfdiscreteisTruethen 1) this affects the default level-generation algorithm (e.g.norm='log'builds levels in log-space) and 2) this is passed toDiscreteNormto scale the colors before they are discretized (ifnormis not already aDiscreteNorm). Ifrc['cmap.autodiverging']isTrueand the normalization range contains negative and positive values thenDivergingNormis used. OtherwiseNormalizeis used.extend (
{'neither', 'both', 'min', 'max'}, default:'neither') – Direction for drawing colorbar “extensions” indicating out-of-bounds data on the end of the colorbar.discrete (
bool, default:rc['cmap.discrete']=None) – IfFalse, thenDiscreteNormis not applied to the colormap. Instead, for non-contour plots, the number of levels will be roughly controlled byrc['cmap.lut']. This has a similar effect to usinglevels=large_numberbut it may improve rendering speed. Default isTrueonly for contouring commands likecontourfand pseudocolor commands likepcolor.sequential, diverging, cyclic, qualitative (
bool, default:None) – Boolean arguments used ifcmapis not passed. Set these toTrueto use the defaultrc['cmap.sequential'],rc['cmap.diverging'],rc['cmap.cyclic'], andrc['cmap.qualitative']colormaps. Thedivergingoption also appliesDivergingNormas the default continuous normalizer.N – Shorthand for
levels.levels (
intor sequence offloat, default:rc['cmap.levels']=11) – The number of level edges or a sequence of level edges. If the former,locatoris used to generate this many level edges at “nice” intervals. If the latter, the levels should be monotonically increasing or decreasing (note decreasing levels fail withcontourplots).values (
intor sequence offloat, default:None) – The number of level centers or a sequence of level centers. If the former,locatoris used to generate this many level centers at “nice” intervals. If the latter, levels are inferred usingedges. This will override anylevelsinput.center_levels (
bool, defaultFalse) – If set to true, the discrete color bar bins will be centered on the level values instead of using the level values as the edges of the discrete bins. This option can be used for diverging, discrete color bars with both positive and negative data to ensure data near zero is properly represented.robust (
bool,float, or2-tuple, default:rc['cmap.robust']=False) – IfTrueandvminorvmaxwere not provided, they are determined from the 2nd and 98th data percentiles rather than the minimum and maximum. If float, this percentile range is used (for example,90corresponds to the 5th to 95th percentiles). If 2-tuple of float, these specific percentiles should be used. This feature is useful when your data has large outliers.inbounds (
bool, default:rc['cmap.inbounds']=True) – IfTrueandvminorvmaxwere not provided, when axis limits have been explicitly restricted withset_xlim()orset_ylim(), out-of-bounds data is ignored. See alsorc['cmap.inbounds']andrc['axes.inbounds'].locator (
locator-spec, default:matplotlib.ticker.MaxNLocator) – The locator used to determine level locations iflevelsorvalueswere not already passed as lists. Passed to theLocatorconstructor. Default isMaxNLocatorwithlevelsinteger levels.locator_kw (dict-like, optional) – Keyword arguments passed to
matplotlib.ticker.Locatorclass.symmetric (
bool, default:False) – IfTrue, the normalization range or discrete colormap levels are symmetric about zero.positive (
bool, default:False) – IfTrue, the normalization range or discrete colormap levels are positive with a minimum at zero.negative (
bool, default:False) – IfTrue, the normaliation range or discrete colormap levels are negative with a minimum at zero.nozero (
bool, default:False) – IfTrue,0is removed from the level list. This is mainly useful for single-colorcontourplots.cycle (
cycle-spec, optional) – The cycle specifer, passed to theCycleconstructor. If the returned cycler is unchanged from the current cycler, the axes cycler will not be reset to its first position. To disable property cycling and just use black for the default color, usecycle=False,cycle='none', orcycle=()(analogous to disabling ticks with e.g.xformatter='none'). To restore the default property cycler, usecycle=True.lw, linewidth, linewidths, mew, markeredgewidth, markeredgewidths (
floator sequence, optional) – The marker edge width(s).edgecolors, markeredgecolor, markeredgecolors (
color-specor sequence, optional) – The marker edge color(s).mean, means (
bool, default:False) – Whether to plot the means of each column for 2Dxcoordinates. Means are calculated withnumpy.nanmean. If no other arguments are specified, this also setsbarstd=True(andboxstd=Truefor violin plots).median, medians (
bool, default:False) – Whether to plot the medians of each column for 2Dxcoordinates. Medians are calculated withnumpy.nanmedian. If no other arguments arguments are specified, this also setsbarstd=True(andboxstd=Truefor violin plots).barstd, barstds (
bool,float, or2-tupleoffloat, optional) – Valid only ifmeanormedianisTrue. Standard deviation multiples for thin error bars with optional whiskers (i.e., caps). If scalar, then +/- that multiple is used. IfTrue, the default standard deviation range of +/-3 is used.barpctile, barpctiles (
bool,float, or2-tupleoffloat, optional) – Valid only ifmeanormedianisTrue. As withbarstd, but instead using percentiles for the error bars. If scalar, that percentile range is used (e.g.,90shows the 5th to 95th percentiles). IfTrue, the default percentile range of 0 to 100 is used.bardata (array-like, optional) – Valid only if
meanandmedianareFalse. If shape is 2 x N, these are the lower and upper bounds for the thin error bars. If shape is N, these are the absolute, symmetric deviations from the central points.boxes (
bool, default:None) – Shorthand forboxstd,boxstds.boxstd, boxstds, boxpctile, boxpctiles, boxdata (optional) – As with
barstd,barpctile, andbardata, but for thicker error bars representing a smaller interval than the thin error bars. IfboxstdsisTrue, the default standard deviation range of +/-1 is used. IfboxpctilesisTrue, the default percentile range of 25 to 75 is used (i.e., the interquartile range). When “boxes” and “bars” are combined, this has the effect of drawing miniature box-and-whisker plots.capsize (
float, default:rc['errorbar.capsize']=3.0) – The cap size for thin error bars in points.barz, barzorder, boxz, boxzorder (
float, default:2.5) – The “zorder” for the thin and thick error bars.barc, barcolor, boxc, boxcolor (
color-spec, default:rc['boxplot.whiskerprops.color']='black') – Colors for the thin and thick error bars.barlw, barlinewidth, boxlw, boxlinewidth (
float, default:rc['boxplot.whiskerprops.linewidth']=1.0) – Line widths for the thin and thick error bars, in points. The default for boxes is 4 timesrc['boxplot.whiskerprops.linewidth'].boxm, boxmarker (
boolormarker-spec, default:'o') – Whether to draw a small marker in the middle of the box denoting the mean or median position. Ignored ifboxesisFalse.boxms, boxmarkersize (
size-spec, default:(2 * boxlinewidth) ** 2) – The marker size for theboxmarkermarker in points ** 2.boxmc, boxmarkercolor, boxmec, boxmarkeredgecolor (
color-spec, default:'w') – Color, face color, and edge color for theboxmarkermarker.shadestd, shadestds, shadepctile, shadepctiles, shadedata (optional) – As with
barstd,barpctile, andbardata, but using shading to indicate the error range. IfshadestdsisTrue, the default standard deviation range of +/-2 is used. IfshadepctilesisTrue, the default percentile range of 10 to 90 is used.fadestd, fadestds, fadepctile, fadepctiles, fadedata (optional) – As with
shadestd,shadepctile, andshadedata, but for an additional, more faded, secondary shaded region. IffadestdsisTrue, the default standard deviation range of +/-3 is used. IffadepctilesisTrue, the default percentile range of 0 to 100 is used.shadec, shadecolor, fadec, fadecolor (
color-spec, default:None) – Colors for the different shaded regions. The parent artist color is used by default.shadez, shadezorder, fadez, fadezorder (
float, default:1.5) – The “zorder” for the different shaded regions.shadea, shadealpha, fadea, fadealpha (
float, default:0.4,0.2) – The opacity for the different shaded regions.shadelw, shadelinewidth, fadelw, fadelinewidth (
float, default:rc['patch.linewidth']=0.6.) – The edge line width for the shading patches.shdeec, shadeedgecolor, fadeec, fadeedgecolor (
float, default:'none') – The edge color for the shading patches.shadelabel, fadelabel (
boolorstr, optional) – Labels for the shaded regions to be used as separate legend entries. To toggle labels “on” and apply a default label, use e.g.shadelabel=True. To apply a custom label, use e.g.shadelabel='label'. Otherwise, the shading is drawn underneath the line and/or marker in the legend entry.inbounds (
bool, default:rc['axes.inbounds']=True) – Whether to restrict the defaulty(x) axis limits to account for only in-bounds data when thex(y) axis limits have been locked. See alsorc['axes.inbounds']andrc['cmap.inbounds'].label, value (
floatorstr, optional) – The single legend label or colorbar coordinate to be used for this plotted element. Can be numeric or string. This is generally used with 1D positional arguments.labels, values (sequence of
floator sequence ofstr, optional) – The legend labels or colorbar coordinates used for each plotted element. Can be numeric or string, and must match the number of plotted elements. This is generally used with 2D positional arguments.colorbar (
bool,int, orstr, optional) – If notNone, this is a location specifying where to draw an inset or outer colorbar from the resulting object(s). IfTrue, the defaultrc['colorbar.loc']='right'is used. If the same location is used in successive plotting calls, object(s) will be added to the existing colorbar in that location (valid for colorbars built from lists of artists). Valid locations are shown in incolorbar.colorbar_kw (dict-like, optional) – Extra keyword args for the call to
colorbar.legend (
bool,int, orstr, optional) – Location specifying where to draw an inset or outer legend from the resulting object(s). IfTrue, the defaultrc['legend.loc']='best'is used. If the same location is used in successive plotting calls, object(s) will be added to existing legend in that location. Valid locations are shown inlegend().legend_kw (dict-like, optional) – Extra keyword args for the call to
legend.**kwargs – Passed to
scatter.See for more info on the grouping behavior :func:`~ultraplot.PlotAxes.bar`, and for formatting :func:`~ultraplot.PlotAxes.scatter`.
- Returns:
ListofPatchCollection, anda ~matplotlib.collections.LineCollection
- lollipoph(*args, **kwargs)[source]
Plot individual or group lollipop graphs.
A lollipop graph is a bar graph with the bars replaced by dots connected to the x-axis by lines.
Inputs such as arrays (
xory) or dataframes (pandasorxarray) are passed throughbar(). Colors are inferred from the bar objects and parsed automatically. Formatting of the lollipop consists of controlling thestemand themarker. The stem properties can be set for the width, size, or color. Marker formatting follows the same inputs toscatter().- Parameters:
*args (
xory,x) – The data passed as positional or keyword arguments. Interpreted as follows:If only
xcoordinates are passed, try to infer theycoordinates from theSeriesorDataFrameindices or theDataArraycoordinates. Otherwise, theycoordinates arenp.arange(0, x.shape[0]).If the
xcoordinates are a 2D array, plot each column of data in succession (except where each column of data represents a statistical distribution, as withboxplot,violinplot, or when usingmeans=Trueormedians=True).If any arguments are
pint.Quantity, auto-add the pint unit registry to matplotlib’s unit registry usingsetup_matplotlib. Apint.Quantityembedded in anxarray.DataArrayis also supported.
stemlinewdith (
str, default :py:class:rc[`”lollipop.stemlinewidth”:py:class:`])stemcolor (
str, default :py:class:rc[`”lollipop.stemcolor”:py:class:`]) – Line color of the lines connecting the dots to the x-axis. Defaults torc["lollipop.linecolor"].stemlinestyle (
str, default: :py:class:rc[`”lollipop.stemlinestyle”:py:class:`]) – The style of the lines connecting the dots to the x-axis. Defaults torc["lollipop.linestyle"].s, size, ms, markersize (
floator array-like orunit-spec, optional) – The marker size area(s). If this is an array matching the shape ofxandy, the units are scaled bysminandsmax. If this contains unit string(s), it is processed byunitsand represents the width rather than area.c, color, colors, mc, markercolor, markercolors, fc, facecolor, facecolors (array-like or
color-spec, optional) – The marker color(s). If this is an array matching the shape ofxandy, the colors are generated usingcmap,norm,vmin, andvmax. Otherwise, this should be a valid matplotlib color.smin, smax (
float, optional) – The minimum and maximum marker size area in unitspoints ** 2. Ignored ifabsolute_sizeisTrue. Default value forsminis1and forsmaxis the square ofrc['lines.markersize']=6.0.area_size (
bool, default:True) – Whether the marker sizessare scaled by area or by radius. The defaultTrueis consistent with matplotlib. Whenabsolute_sizeisTrue, thesunits arepoints ** 2ifarea_sizeisTrueandpointsifarea_sizeisFalse.absolute_size (
bool, default:TrueorFalse) – Whethersshould be taken to represent “absolute” marker sizes in unitspointsorpoints ** 2or “relative” marker sizes scaled bysminandsmax. Default isTrueifsis scalar andFalseifsis array-like orsminorsmaxwere passed.vmin, vmax (
float, optional) – The minimum and maximum color scale values used with thenormnormalizer. IfdiscreteisFalsethese are the absolute limits, and ifdiscreteisTruethese are the approximate limits used to automatically determinelevelsorvalueslists at “nice” intervals. Iflevelsorvalueswere already passed as lists, these are ignored, andvminandvmaxare set to the minimum and maximum of the lists. Ifrobustwas passed, the defaultvminandvmaxare some percentile range of the data values. Otherwise, the defaultvminandvmaxare the minimum and maximum of the data values.data (dict-like, optional) – A dict-like dataset container (e.g.,
DataFrameorDataset). If passed, each data argument can optionally be a stringkeyand the arrays used for plotting are retrieved withdata[key]. This is a native matplotlib feature.autoformat (
bool, default:rc.autoformat=True) – Whether thexaxis labels,yaxis labels, axis formatters, axes titles, legend titles, and colorbar labels are automatically configured when aSeries,DataFrame,DataArray, orQuantityis passed to the plotting command. Formatting ofpint.Quantityunit strings is controlled byrc.unitformat='L'.
- Other Parameters:
cmap (
colormap-spec, default:rc['cmap.sequential']='Fire'orrc['cmap.diverging']='BuRd') – The colormap specifer, passed to theColormapconstructor function. Ifrc['cmap.autodiverging']isTrueand the normalization range contains negative and positive values thenrc['cmap.diverging']is used. Otherwiserc['cmap.sequential']is used.c, color, colors (
color-specor sequence ofcolor-spec, optional) – The color(s) used to create aDiscreteColormap. If not passed,cmapis used.norm (
norm-spec, default:NormalizeorDivergingNorm) – The data value normalizer, passed to theNormconstructor function. IfdiscreteisTruethen 1) this affects the default level-generation algorithm (e.g.norm='log'builds levels in log-space) and 2) this is passed toDiscreteNormto scale the colors before they are discretized (ifnormis not already aDiscreteNorm). Ifrc['cmap.autodiverging']isTrueand the normalization range contains negative and positive values thenDivergingNormis used. OtherwiseNormalizeis used.extend (
{'neither', 'both', 'min', 'max'}, default:'neither') – Direction for drawing colorbar “extensions” indicating out-of-bounds data on the end of the colorbar.discrete (
bool, default:rc['cmap.discrete']=None) – IfFalse, thenDiscreteNormis not applied to the colormap. Instead, for non-contour plots, the number of levels will be roughly controlled byrc['cmap.lut']. This has a similar effect to usinglevels=large_numberbut it may improve rendering speed. Default isTrueonly for contouring commands likecontourfand pseudocolor commands likepcolor.sequential, diverging, cyclic, qualitative (
bool, default:None) – Boolean arguments used ifcmapis not passed. Set these toTrueto use the defaultrc['cmap.sequential'],rc['cmap.diverging'],rc['cmap.cyclic'], andrc['cmap.qualitative']colormaps. Thedivergingoption also appliesDivergingNormas the default continuous normalizer.N – Shorthand for
levels.levels (
intor sequence offloat, default:rc['cmap.levels']=11) – The number of level edges or a sequence of level edges. If the former,locatoris used to generate this many level edges at “nice” intervals. If the latter, the levels should be monotonically increasing or decreasing (note decreasing levels fail withcontourplots).values (
intor sequence offloat, default:None) – The number of level centers or a sequence of level centers. If the former,locatoris used to generate this many level centers at “nice” intervals. If the latter, levels are inferred usingedges. This will override anylevelsinput.center_levels (
bool, defaultFalse) – If set to true, the discrete color bar bins will be centered on the level values instead of using the level values as the edges of the discrete bins. This option can be used for diverging, discrete color bars with both positive and negative data to ensure data near zero is properly represented.robust (
bool,float, or2-tuple, default:rc['cmap.robust']=False) – IfTrueandvminorvmaxwere not provided, they are determined from the 2nd and 98th data percentiles rather than the minimum and maximum. If float, this percentile range is used (for example,90corresponds to the 5th to 95th percentiles). If 2-tuple of float, these specific percentiles should be used. This feature is useful when your data has large outliers.inbounds (
bool, default:rc['cmap.inbounds']=True) – IfTrueandvminorvmaxwere not provided, when axis limits have been explicitly restricted withset_xlim()orset_ylim(), out-of-bounds data is ignored. See alsorc['cmap.inbounds']andrc['axes.inbounds'].locator (
locator-spec, default:matplotlib.ticker.MaxNLocator) – The locator used to determine level locations iflevelsorvalueswere not already passed as lists. Passed to theLocatorconstructor. Default isMaxNLocatorwithlevelsinteger levels.locator_kw (dict-like, optional) – Keyword arguments passed to
matplotlib.ticker.Locatorclass.symmetric (
bool, default:False) – IfTrue, the normalization range or discrete colormap levels are symmetric about zero.positive (
bool, default:False) – IfTrue, the normalization range or discrete colormap levels are positive with a minimum at zero.negative (
bool, default:False) – IfTrue, the normaliation range or discrete colormap levels are negative with a minimum at zero.nozero (
bool, default:False) – IfTrue,0is removed from the level list. This is mainly useful for single-colorcontourplots.cycle (
cycle-spec, optional) – The cycle specifer, passed to theCycleconstructor. If the returned cycler is unchanged from the current cycler, the axes cycler will not be reset to its first position. To disable property cycling and just use black for the default color, usecycle=False,cycle='none', orcycle=()(analogous to disabling ticks with e.g.xformatter='none'). To restore the default property cycler, usecycle=True.lw, linewidth, linewidths, mew, markeredgewidth, markeredgewidths (
floator sequence, optional) – The marker edge width(s).edgecolors, markeredgecolor, markeredgecolors (
color-specor sequence, optional) – The marker edge color(s).mean, means (
bool, default:False) – Whether to plot the means of each column for 2Dxcoordinates. Means are calculated withnumpy.nanmean. If no other arguments are specified, this also setsbarstd=True(andboxstd=Truefor violin plots).median, medians (
bool, default:False) – Whether to plot the medians of each column for 2Dxcoordinates. Medians are calculated withnumpy.nanmedian. If no other arguments arguments are specified, this also setsbarstd=True(andboxstd=Truefor violin plots).barstd, barstds (
bool,float, or2-tupleoffloat, optional) – Valid only ifmeanormedianisTrue. Standard deviation multiples for thin error bars with optional whiskers (i.e., caps). If scalar, then +/- that multiple is used. IfTrue, the default standard deviation range of +/-3 is used.barpctile, barpctiles (
bool,float, or2-tupleoffloat, optional) – Valid only ifmeanormedianisTrue. As withbarstd, but instead using percentiles for the error bars. If scalar, that percentile range is used (e.g.,90shows the 5th to 95th percentiles). IfTrue, the default percentile range of 0 to 100 is used.bardata (array-like, optional) – Valid only if
meanandmedianareFalse. If shape is 2 x N, these are the lower and upper bounds for the thin error bars. If shape is N, these are the absolute, symmetric deviations from the central points.boxes (
bool, default:None) – Shorthand forboxstd,boxstds.boxstd, boxstds, boxpctile, boxpctiles, boxdata (optional) – As with
barstd,barpctile, andbardata, but for thicker error bars representing a smaller interval than the thin error bars. IfboxstdsisTrue, the default standard deviation range of +/-1 is used. IfboxpctilesisTrue, the default percentile range of 25 to 75 is used (i.e., the interquartile range). When “boxes” and “bars” are combined, this has the effect of drawing miniature box-and-whisker plots.capsize (
float, default:rc['errorbar.capsize']=3.0) – The cap size for thin error bars in points.barz, barzorder, boxz, boxzorder (
float, default:2.5) – The “zorder” for the thin and thick error bars.barc, barcolor, boxc, boxcolor (
color-spec, default:rc['boxplot.whiskerprops.color']='black') – Colors for the thin and thick error bars.barlw, barlinewidth, boxlw, boxlinewidth (
float, default:rc['boxplot.whiskerprops.linewidth']=1.0) – Line widths for the thin and thick error bars, in points. The default for boxes is 4 timesrc['boxplot.whiskerprops.linewidth'].boxm, boxmarker (
boolormarker-spec, default:'o') – Whether to draw a small marker in the middle of the box denoting the mean or median position. Ignored ifboxesisFalse.boxms, boxmarkersize (
size-spec, default:(2 * boxlinewidth) ** 2) – The marker size for theboxmarkermarker in points ** 2.boxmc, boxmarkercolor, boxmec, boxmarkeredgecolor (
color-spec, default:'w') – Color, face color, and edge color for theboxmarkermarker.shadestd, shadestds, shadepctile, shadepctiles, shadedata (optional) – As with
barstd,barpctile, andbardata, but using shading to indicate the error range. IfshadestdsisTrue, the default standard deviation range of +/-2 is used. IfshadepctilesisTrue, the default percentile range of 10 to 90 is used.fadestd, fadestds, fadepctile, fadepctiles, fadedata (optional) – As with
shadestd,shadepctile, andshadedata, but for an additional, more faded, secondary shaded region. IffadestdsisTrue, the default standard deviation range of +/-3 is used. IffadepctilesisTrue, the default percentile range of 0 to 100 is used.shadec, shadecolor, fadec, fadecolor (
color-spec, default:None) – Colors for the different shaded regions. The parent artist color is used by default.shadez, shadezorder, fadez, fadezorder (
float, default:1.5) – The “zorder” for the different shaded regions.shadea, shadealpha, fadea, fadealpha (
float, default:0.4,0.2) – The opacity for the different shaded regions.shadelw, shadelinewidth, fadelw, fadelinewidth (
float, default:rc['patch.linewidth']=0.6.) – The edge line width for the shading patches.shdeec, shadeedgecolor, fadeec, fadeedgecolor (
float, default:'none') – The edge color for the shading patches.shadelabel, fadelabel (
boolorstr, optional) – Labels for the shaded regions to be used as separate legend entries. To toggle labels “on” and apply a default label, use e.g.shadelabel=True. To apply a custom label, use e.g.shadelabel='label'. Otherwise, the shading is drawn underneath the line and/or marker in the legend entry.inbounds (
bool, default:rc['axes.inbounds']=True) – Whether to restrict the defaulty(x) axis limits to account for only in-bounds data when thex(y) axis limits have been locked. See alsorc['axes.inbounds']andrc['cmap.inbounds'].label, value (
floatorstr, optional) – The single legend label or colorbar coordinate to be used for this plotted element. Can be numeric or string. This is generally used with 1D positional arguments.labels, values (sequence of
floator sequence ofstr, optional) – The legend labels or colorbar coordinates used for each plotted element. Can be numeric or string, and must match the number of plotted elements. This is generally used with 2D positional arguments.colorbar (
bool,int, orstr, optional) – If notNone, this is a location specifying where to draw an inset or outer colorbar from the resulting object(s). IfTrue, the defaultrc['colorbar.loc']='right'is used. If the same location is used in successive plotting calls, object(s) will be added to the existing colorbar in that location (valid for colorbars built from lists of artists). Valid locations are shown in incolorbar.colorbar_kw (dict-like, optional) – Extra keyword args for the call to
colorbar.legend (
bool,int, orstr, optional) – Location specifying where to draw an inset or outer legend from the resulting object(s). IfTrue, the defaultrc['legend.loc']='best'is used. If the same location is used in successive plotting calls, object(s) will be added to existing legend in that location. Valid locations are shown inlegend().legend_kw (dict-like, optional) – Extra keyword args for the call to
legend.**kwargs – Passed to
scatter.See for more info on the grouping behavior :func:`~ultraplot.PlotAxes.bar`, and for formatting :func:`~ultraplot.PlotAxes.scatter`.
- Returns:
ListofPatchCollection, anda ~matplotlib.collections.LineCollection (horizontal lollipop)
- matshow(**kwargs)[source]
Plot a matrix.
- Parameters:
z (array-like) – The data passed as a positional argument or keyword argument.
data (dict-like, optional) – A dict-like dataset container (e.g.,
DataFrameorDataset). If passed, each data argument can optionally be a stringkeyand the arrays used for plotting are retrieved withdata[key]. This is a native matplotlib feature.autoformat (
bool, default:rc.autoformat=True) – Whether thexaxis labels,yaxis labels, axis formatters, axes titles, legend titles, and colorbar labels are automatically configured when aSeries,DataFrame,DataArray, orQuantityis passed to the plotting command. Formatting ofpint.Quantityunit strings is controlled byrc.unitformat='L'.
- Other Parameters:
cmap (
colormap-spec, default:rc['cmap.sequential']='Fire'orrc['cmap.diverging']='BuRd') – The colormap specifer, passed to theColormapconstructor function. Ifrc['cmap.autodiverging']isTrueand the normalization range contains negative and positive values thenrc['cmap.diverging']is used. Otherwiserc['cmap.sequential']is used.c, color, colors (
color-specor sequence ofcolor-spec, optional) – The color(s) used to create aDiscreteColormap. If not passed,cmapis used.norm (
norm-spec, default:NormalizeorDivergingNorm) – The data value normalizer, passed to theNormconstructor function. IfdiscreteisTruethen 1) this affects the default level-generation algorithm (e.g.norm='log'builds levels in log-space) and 2) this is passed toDiscreteNormto scale the colors before they are discretized (ifnormis not already aDiscreteNorm). Ifrc['cmap.autodiverging']isTrueand the normalization range contains negative and positive values thenDivergingNormis used. OtherwiseNormalizeis used.extend (
{'neither', 'both', 'min', 'max'}, default:'neither') – Direction for drawing colorbar “extensions” indicating out-of-bounds data on the end of the colorbar.discrete (
bool, default:rc['cmap.discrete']=None) – IfFalse, thenDiscreteNormis not applied to the colormap. Instead, for non-contour plots, the number of levels will be roughly controlled byrc['cmap.lut']. This has a similar effect to usinglevels=large_numberbut it may improve rendering speed. Default isTrueonly for contouring commands likecontourfand pseudocolor commands likepcolor.sequential, diverging, cyclic, qualitative (
bool, default:None) – Boolean arguments used ifcmapis not passed. Set these toTrueto use the defaultrc['cmap.sequential'],rc['cmap.diverging'],rc['cmap.cyclic'], andrc['cmap.qualitative']colormaps. Thedivergingoption also appliesDivergingNormas the default continuous normalizer.vmin, vmax (
float, optional) – The minimum and maximum color scale values used with thenormnormalizer. IfdiscreteisFalsethese are the absolute limits, and ifdiscreteisTruethese are the approximate limits used to automatically determinelevelsorvalueslists at “nice” intervals. Iflevelsorvalueswere already passed as lists, these are ignored, andvminandvmaxare set to the minimum and maximum of the lists. Ifrobustwas passed, the defaultvminandvmaxare some percentile range of the data values. Otherwise, the defaultvminandvmaxare the minimum and maximum of the data values.N – Shorthand for
levels.levels (
intor sequence offloat, default:rc['cmap.levels']=11) – The number of level edges or a sequence of level edges. If the former,locatoris used to generate this many level edges at “nice” intervals. If the latter, the levels should be monotonically increasing or decreasing (note decreasing levels fail withcontourplots).values (
intor sequence offloat, default:None) – The number of level centers or a sequence of level centers. If the former,locatoris used to generate this many level centers at “nice” intervals. If the latter, levels are inferred usingedges. This will override anylevelsinput.center_levels (
bool, defaultFalse) – If set to true, the discrete color bar bins will be centered on the level values instead of using the level values as the edges of the discrete bins. This option can be used for diverging, discrete color bars with both positive and negative data to ensure data near zero is properly represented.robust (
bool,float, or2-tuple, default:rc['cmap.robust']=False) – IfTrueandvminorvmaxwere not provided, they are determined from the 2nd and 98th data percentiles rather than the minimum and maximum. If float, this percentile range is used (for example,90corresponds to the 5th to 95th percentiles). If 2-tuple of float, these specific percentiles should be used. This feature is useful when your data has large outliers.inbounds (
bool, default:rc['cmap.inbounds']=True) – IfTrueandvminorvmaxwere not provided, when axis limits have been explicitly restricted withset_xlim()orset_ylim(), out-of-bounds data is ignored. See alsorc['cmap.inbounds']andrc['axes.inbounds'].locator (
locator-spec, default:matplotlib.ticker.MaxNLocator) – The locator used to determine level locations iflevelsorvalueswere not already passed as lists. Passed to theLocatorconstructor. Default isMaxNLocatorwithlevelsinteger levels.locator_kw (dict-like, optional) – Keyword arguments passed to
matplotlib.ticker.Locatorclass.symmetric (
bool, default:False) – IfTrue, the normalization range or discrete colormap levels are symmetric about zero.positive (
bool, default:False) – IfTrue, the normalization range or discrete colormap levels are positive with a minimum at zero.negative (
bool, default:False) – IfTrue, the normaliation range or discrete colormap levels are negative with a minimum at zero.nozero (
bool, default:False) – IfTrue,0is removed from the level list. This is mainly useful for single-colorcontourplots.colorbar (
bool,int, orstr, optional) – If notNone, this is a location specifying where to draw an inset or outer colorbar from the resulting object(s). IfTrue, the defaultrc['colorbar.loc']='right'is used. If the same location is used in successive plotting calls, object(s) will be added to the existing colorbar in that location (valid for colorbars built from lists of artists). Valid locations are shown in incolorbar.colorbar_kw (dict-like, optional) – Extra keyword args for the call to
colorbar.legend (
bool,int, orstr, optional) – Location specifying where to draw an inset or outer legend from the resulting object(s). IfTrue, the defaultrc['legend.loc']='best'is used. If the same location is used in successive plotting calls, object(s) will be added to existing legend in that location. Valid locations are shown inlegend().legend_kw (dict-like, optional) – Extra keyword args for the call to
legend.**kwargs – Passed to
matplotlib.axes.Axes.matshow.
- parametric(x, y, c, *, interp=0, scalex=True, scaley=True, **kwargs)[source]
Plot a parametric line.
- Parameters:
*args (
yorx,y) – The data passed as positional or keyword arguments. Interpreted as follows:If only
ycoordinates are passed, try to infer thexcoordinates from theSeriesorDataFrameindices or theDataArraycoordinates. Otherwise, thexcoordinates arenp.arange(0, y.shape[0]).If the
ycoordinates are a 2D array, plot each column of data in succession (except where each column of data represents a statistical distribution, as withboxplot,violinplot, or when usingmeans=Trueormedians=True).If any arguments are
pint.Quantity, auto-add the pint unit registry to matplotlib’s unit registry usingsetup_matplotlib. Apint.Quantityembedded in anxarray.DataArrayis also supported.
c, color, colors, values, labels (sequence of
float,str, orcolor-spec, optional) – The parametric coordinate(s). These can be passed as a third positional argument or as a keyword argument. If they are float, the colors will be determined fromnormandcmap. If they are strings, the color values will benp.arange(len(colors))and eventual colorbar ticks will be labeled with the strings. If they are colors, they are used for the line segments andcmapis ignored – for example,colors='blue'makes a monochromatic “parametric” line.interp (
int, default:0) – Interpolate to this many additional points between the parametric coordinates. This can be increased to make the color gradations between a small number of coordinates appear “smooth”.data (dict-like, optional) – A dict-like dataset container (e.g.,
DataFrameorDataset). If passed, each data argument can optionally be a stringkeyand the arrays used for plotting are retrieved withdata[key]. This is a native matplotlib feature.autoformat (
bool, default:rc.autoformat=True) – Whether thexaxis labels,yaxis labels, axis formatters, axes titles, legend titles, and colorbar labels are automatically configured when aSeries,DataFrame,DataArray, orQuantityis passed to the plotting command. Formatting ofpint.Quantityunit strings is controlled byrc.unitformat='L'.
- Other Parameters:
cmap (
colormap-spec, default:rc['cmap.sequential']='Fire'orrc['cmap.diverging']='BuRd') – The colormap specifer, passed to theColormapconstructor function. Ifrc['cmap.autodiverging']isTrueand the normalization range contains negative and positive values thenrc['cmap.diverging']is used. Otherwiserc['cmap.sequential']is used.c, color, colors (
color-specor sequence ofcolor-spec, optional) – The color(s) used to create aDiscreteColormap. If not passed,cmapis used.norm (
norm-spec, default:NormalizeorDivergingNorm) – The data value normalizer, passed to theNormconstructor function. IfdiscreteisTruethen 1) this affects the default level-generation algorithm (e.g.norm='log'builds levels in log-space) and 2) this is passed toDiscreteNormto scale the colors before they are discretized (ifnormis not already aDiscreteNorm). Ifrc['cmap.autodiverging']isTrueand the normalization range contains negative and positive values thenDivergingNormis used. OtherwiseNormalizeis used.extend (
{'neither', 'both', 'min', 'max'}, default:'neither') – Direction for drawing colorbar “extensions” indicating out-of-bounds data on the end of the colorbar.discrete (
bool, default:rc['cmap.discrete']=None) – IfFalse, thenDiscreteNormis not applied to the colormap. Instead, for non-contour plots, the number of levels will be roughly controlled byrc['cmap.lut']. This has a similar effect to usinglevels=large_numberbut it may improve rendering speed. Default isTrueonly for contouring commands likecontourfand pseudocolor commands likepcolor.sequential, diverging, cyclic, qualitative (
bool, default:None) – Boolean arguments used ifcmapis not passed. Set these toTrueto use the defaultrc['cmap.sequential'],rc['cmap.diverging'],rc['cmap.cyclic'], andrc['cmap.qualitative']colormaps. Thedivergingoption also appliesDivergingNormas the default continuous normalizer.vmin, vmax (
float, optional) – The minimum and maximum color scale values used with thenormnormalizer. IfdiscreteisFalsethese are the absolute limits, and ifdiscreteisTruethese are the approximate limits used to automatically determinelevelsorvalueslists at “nice” intervals. Iflevelsorvalueswere already passed as lists, these are ignored, andvminandvmaxare set to the minimum and maximum of the lists. Ifrobustwas passed, the defaultvminandvmaxare some percentile range of the data values. Otherwise, the defaultvminandvmaxare the minimum and maximum of the data values.inbounds (
bool, default:rc['axes.inbounds']=True) – Whether to restrict the defaulty(x) axis limits to account for only in-bounds data when thex(y) axis limits have been locked. See alsorc['axes.inbounds']andrc['cmap.inbounds'].scalex, scaley (
bool, optional) – Whether the view limits are adapted to the data limits. The values are passed on toautoscale_view.label, value (
floatorstr, optional) – The single legend label or colorbar coordinate to be used for this plotted element. Can be numeric or string. This is generally used with 1D positional arguments.colorbar (
bool,int, orstr, optional) – If notNone, this is a location specifying where to draw an inset or outer colorbar from the resulting object(s). IfTrue, the defaultrc['colorbar.loc']='right'is used. If the same location is used in successive plotting calls, object(s) will be added to the existing colorbar in that location (valid for colorbars built from lists of artists). Valid locations are shown in incolorbar.colorbar_kw (dict-like, optional) – Extra keyword args for the call to
colorbar.legend (
bool,int, orstr, optional) – Location specifying where to draw an inset or outer legend from the resulting object(s). IfTrue, the defaultrc['legend.loc']='best'is used. If the same location is used in successive plotting calls, object(s) will be added to existing legend in that location. Valid locations are shown inlegend().legend_kw (dict-like, optional) – Extra keyword args for the call to
legend.**kwargs – Valid
LineCollectionproperties.
- Returns:
LineCollection– The parametric line. See this matplotlib example.
- pcolor(**kwargs)[source]
Plot irregular grid boxes.
- Parameters:
*args (
zorx,y,z) – The data passed as positional or keyword arguments. Interpreted as follows:If only
zcoordinates are passed, try to infer thexandycoordinates from theDataFrameindices and columns or theDataArraycoordinates. Otherwise, theycoordinates arenp.arange(0, y.shape[0])and thexcoordinates arenp.arange(0, y.shape[1]).For
pcolorandpcolormesh, calculate coordinate edges usingedgesor:func:`~ultraplot.utils.edges2d`if centers were provided. For all other methods, calculate coordinate centers if edges were provided.If the
xorycoordinates arepint.Quantity, auto-add the pint unit registry to matplotlib’s unit registry usingsetup_matplotlib. If thezcoordinates arepint.Quantity, pass the magnitude to the plotting command. Apint.Quantityembedded in anxarray.DataArrayis also supported.
data (dict-like, optional) – A dict-like dataset container (e.g.,
DataFrameorDataset). If passed, each data argument can optionally be a stringkeyand the arrays used for plotting are retrieved withdata[key]. This is a native matplotlib feature.autoformat (
bool, default:rc.autoformat=True) – Whether thexaxis labels,yaxis labels, axis formatters, axes titles, legend titles, and colorbar labels are automatically configured when aSeries,DataFrame,DataArray, orQuantityis passed to the plotting command. Formatting ofpint.Quantityunit strings is controlled byrc.unitformat='L'.transpose (
bool, default:False) – Whether to transpose the input data. This should be used when passing datasets with column-major dimension order(x, y). Otherwise row-major dimension order(y, x)is expected.order (
{'C', 'F'}, default:'C') – Alternative totranspose.'C'corresponds to the default C-cyle row-major ordering (equivalent totranspose=False).'F'corresponds to Fortran-style column-major ordering (equivalent totranspose=True).globe (
bool, default:False) – Forultraplot.axes.GeoAxesonly. Whether to enforce global coverage. When set toTruethis does the following:Interpolates input data to the North and South poles by setting the data values at the poles to the mean from latitudes nearest each pole.
Makes meridional coverage “circular”, i.e. the last longitude coordinate equals the first longitude coordinate plus 360°.
When basemap is the backend, cycles 1D longitude vectors to fit within the map edges. For example, if the central longitude is 90°, the data is shifted so that it spans -90° to 270°.
- Other Parameters:
cmap (
colormap-spec, default:rc['cmap.sequential']='Fire'orrc['cmap.diverging']='BuRd') – The colormap specifer, passed to theColormapconstructor function. Ifrc['cmap.autodiverging']isTrueand the normalization range contains negative and positive values thenrc['cmap.diverging']is used. Otherwiserc['cmap.sequential']is used.c, color, colors (
color-specor sequence ofcolor-spec, optional) – The color(s) used to create aDiscreteColormap. If not passed,cmapis used.norm (
norm-spec, default:NormalizeorDivergingNorm) – The data value normalizer, passed to theNormconstructor function. IfdiscreteisTruethen 1) this affects the default level-generation algorithm (e.g.norm='log'builds levels in log-space) and 2) this is passed toDiscreteNormto scale the colors before they are discretized (ifnormis not already aDiscreteNorm). Ifrc['cmap.autodiverging']isTrueand the normalization range contains negative and positive values thenDivergingNormis used. OtherwiseNormalizeis used.extend (
{'neither', 'both', 'min', 'max'}, default:'neither') – Direction for drawing colorbar “extensions” indicating out-of-bounds data on the end of the colorbar.discrete (
bool, default:rc['cmap.discrete']=None) – IfFalse, thenDiscreteNormis not applied to the colormap. Instead, for non-contour plots, the number of levels will be roughly controlled byrc['cmap.lut']. This has a similar effect to usinglevels=large_numberbut it may improve rendering speed. Default isTrueonly for contouring commands likecontourfand pseudocolor commands likepcolor.sequential, diverging, cyclic, qualitative (
bool, default:None) – Boolean arguments used ifcmapis not passed. Set these toTrueto use the defaultrc['cmap.sequential'],rc['cmap.diverging'],rc['cmap.cyclic'], andrc['cmap.qualitative']colormaps. Thedivergingoption also appliesDivergingNormas the default continuous normalizer.vmin, vmax (
float, optional) – The minimum and maximum color scale values used with thenormnormalizer. IfdiscreteisFalsethese are the absolute limits, and ifdiscreteisTruethese are the approximate limits used to automatically determinelevelsorvalueslists at “nice” intervals. Iflevelsorvalueswere already passed as lists, these are ignored, andvminandvmaxare set to the minimum and maximum of the lists. Ifrobustwas passed, the defaultvminandvmaxare some percentile range of the data values. Otherwise, the defaultvminandvmaxare the minimum and maximum of the data values.N – Shorthand for
levels.levels (
intor sequence offloat, default:rc['cmap.levels']=11) – The number of level edges or a sequence of level edges. If the former,locatoris used to generate this many level edges at “nice” intervals. If the latter, the levels should be monotonically increasing or decreasing (note decreasing levels fail withcontourplots).values (
intor sequence offloat, default:None) – The number of level centers or a sequence of level centers. If the former,locatoris used to generate this many level centers at “nice” intervals. If the latter, levels are inferred usingedges. This will override anylevelsinput.center_levels (
bool, defaultFalse) – If set to true, the discrete color bar bins will be centered on the level values instead of using the level values as the edges of the discrete bins. This option can be used for diverging, discrete color bars with both positive and negative data to ensure data near zero is properly represented.robust (
bool,float, or2-tuple, default:rc['cmap.robust']=False) – IfTrueandvminorvmaxwere not provided, they are determined from the 2nd and 98th data percentiles rather than the minimum and maximum. If float, this percentile range is used (for example,90corresponds to the 5th to 95th percentiles). If 2-tuple of float, these specific percentiles should be used. This feature is useful when your data has large outliers.inbounds (
bool, default:rc['cmap.inbounds']=True) – IfTrueandvminorvmaxwere not provided, when axis limits have been explicitly restricted withset_xlim()orset_ylim(), out-of-bounds data is ignored. See alsorc['cmap.inbounds']andrc['axes.inbounds'].locator (
locator-spec, default:matplotlib.ticker.MaxNLocator) – The locator used to determine level locations iflevelsorvalueswere not already passed as lists. Passed to theLocatorconstructor. Default isMaxNLocatorwithlevelsinteger levels.locator_kw (dict-like, optional) – Keyword arguments passed to
matplotlib.ticker.Locatorclass.symmetric (
bool, default:False) – IfTrue, the normalization range or discrete colormap levels are symmetric about zero.positive (
bool, default:False) – IfTrue, the normalization range or discrete colormap levels are positive with a minimum at zero.negative (
bool, default:False) – IfTrue, the normaliation range or discrete colormap levels are negative with a minimum at zero.nozero (
bool, default:False) – IfTrue,0is removed from the level list. This is mainly useful for single-colorcontourplots.lw, linewidth, linewidths (
unit-spec, default:0.3) – The width of lines between grid boxes. If float, units are points. If string, interpreted byunits.ls, linestyle, linestyles (
str, default:'-') – The style of lines between grid boxes.ec, edgecolor, edgecolors (
color-spec, default:'k') – The color of lines between grid boxes.a, alpha, alphas (
float, optional) – The opacity of the grid boxes. Inferred fromcmapby default.edgefix (
boolorfloat, default:rc.edgefix=True) – Whether to fix the common issue where white lines appear between adjacent patches in saved vector graphics (this can slow down figure rendering). See this github repo for a demonstration of the problem. IfTrue, a small default linewidth of0.3is used to cover up the white lines. If float (e.g.edgefix=0.5), this specific linewidth is used to cover up the white lines. This feature is automatically disabled when the patches have transparency.label (
str, optional) – The legend label to be used for this object. In the case of contours, this is paired with the the central artist in the artist list returned bymatplotlib.contour.ContourSet.legend_elements.labels (
bool, optional) – Whether to apply labels to contours and grid boxes. The text will be white when the luminance of the underlying filled contour or grid box is less than 50 and black otherwise.labels_kw (dict-like, optional) – Ignored if
labelsisFalse. Extra keyword args for the labels. For contour plots, this is passed toclabel. Otherwise, this is passed totext.formatter, fmt (
formatter-spec, optional) – TheFormatterused to format number labels. Passed to theFormatterconstructor.formatter_kw (dict-like, optional) – Keyword arguments passed to
matplotlib.ticker.Formatterclass.precision (
int, optional) – The maximum number of decimal places for number labels generated with the default formatterSimpleformatter.colorbar (
bool,int, orstr, optional) – If notNone, this is a location specifying where to draw an inset or outer colorbar from the resulting object(s). IfTrue, the defaultrc['colorbar.loc']='right'is used. If the same location is used in successive plotting calls, object(s) will be added to the existing colorbar in that location (valid for colorbars built from lists of artists). Valid locations are shown in incolorbar.colorbar_kw (dict-like, optional) – Extra keyword args for the call to
colorbar.legend (
bool,int, orstr, optional) – Location specifying where to draw an inset or outer legend from the resulting object(s). IfTrue, the defaultrc['legend.loc']='best'is used. If the same location is used in successive plotting calls, object(s) will be added to existing legend in that location. Valid locations are shown inlegend().legend_kw (dict-like, optional) – Extra keyword args for the call to
legend.**kwargs – Passed to
matplotlib.axes.Axes.pcolor.
- pcolorfast(**kwargs)[source]
Plot grid boxes quickly.
- Parameters:
*args (
zorx,y,z) – The data passed as positional or keyword arguments. Interpreted as follows:If only
zcoordinates are passed, try to infer thexandycoordinates from theDataFrameindices and columns or theDataArraycoordinates. Otherwise, theycoordinates arenp.arange(0, y.shape[0])and thexcoordinates arenp.arange(0, y.shape[1]).For
pcolorandpcolormesh, calculate coordinate edges usingedgesor:func:`~ultraplot.utils.edges2d`if centers were provided. For all other methods, calculate coordinate centers if edges were provided.If the
xorycoordinates arepint.Quantity, auto-add the pint unit registry to matplotlib’s unit registry usingsetup_matplotlib. If thezcoordinates arepint.Quantity, pass the magnitude to the plotting command. Apint.Quantityembedded in anxarray.DataArrayis also supported.
data (dict-like, optional) – A dict-like dataset container (e.g.,
DataFrameorDataset). If passed, each data argument can optionally be a stringkeyand the arrays used for plotting are retrieved withdata[key]. This is a native matplotlib feature.autoformat (
bool, default:rc.autoformat=True) – Whether thexaxis labels,yaxis labels, axis formatters, axes titles, legend titles, and colorbar labels are automatically configured when aSeries,DataFrame,DataArray, orQuantityis passed to the plotting command. Formatting ofpint.Quantityunit strings is controlled byrc.unitformat='L'.transpose (
bool, default:False) – Whether to transpose the input data. This should be used when passing datasets with column-major dimension order(x, y). Otherwise row-major dimension order(y, x)is expected.order (
{'C', 'F'}, default:'C') – Alternative totranspose.'C'corresponds to the default C-cyle row-major ordering (equivalent totranspose=False).'F'corresponds to Fortran-style column-major ordering (equivalent totranspose=True).globe (
bool, default:False) – Forultraplot.axes.GeoAxesonly. Whether to enforce global coverage. When set toTruethis does the following:Interpolates input data to the North and South poles by setting the data values at the poles to the mean from latitudes nearest each pole.
Makes meridional coverage “circular”, i.e. the last longitude coordinate equals the first longitude coordinate plus 360°.
When basemap is the backend, cycles 1D longitude vectors to fit within the map edges. For example, if the central longitude is 90°, the data is shifted so that it spans -90° to 270°.
- Other Parameters:
cmap (
colormap-spec, default:rc['cmap.sequential']='Fire'orrc['cmap.diverging']='BuRd') – The colormap specifer, passed to theColormapconstructor function. Ifrc['cmap.autodiverging']isTrueand the normalization range contains negative and positive values thenrc['cmap.diverging']is used. Otherwiserc['cmap.sequential']is used.c, color, colors (
color-specor sequence ofcolor-spec, optional) – The color(s) used to create aDiscreteColormap. If not passed,cmapis used.norm (
norm-spec, default:NormalizeorDivergingNorm) – The data value normalizer, passed to theNormconstructor function. IfdiscreteisTruethen 1) this affects the default level-generation algorithm (e.g.norm='log'builds levels in log-space) and 2) this is passed toDiscreteNormto scale the colors before they are discretized (ifnormis not already aDiscreteNorm). Ifrc['cmap.autodiverging']isTrueand the normalization range contains negative and positive values thenDivergingNormis used. OtherwiseNormalizeis used.extend (
{'neither', 'both', 'min', 'max'}, default:'neither') – Direction for drawing colorbar “extensions” indicating out-of-bounds data on the end of the colorbar.discrete (
bool, default:rc['cmap.discrete']=None) – IfFalse, thenDiscreteNormis not applied to the colormap. Instead, for non-contour plots, the number of levels will be roughly controlled byrc['cmap.lut']. This has a similar effect to usinglevels=large_numberbut it may improve rendering speed. Default isTrueonly for contouring commands likecontourfand pseudocolor commands likepcolor.sequential, diverging, cyclic, qualitative (
bool, default:None) – Boolean arguments used ifcmapis not passed. Set these toTrueto use the defaultrc['cmap.sequential'],rc['cmap.diverging'],rc['cmap.cyclic'], andrc['cmap.qualitative']colormaps. Thedivergingoption also appliesDivergingNormas the default continuous normalizer.vmin, vmax (
float, optional) – The minimum and maximum color scale values used with thenormnormalizer. IfdiscreteisFalsethese are the absolute limits, and ifdiscreteisTruethese are the approximate limits used to automatically determinelevelsorvalueslists at “nice” intervals. Iflevelsorvalueswere already passed as lists, these are ignored, andvminandvmaxare set to the minimum and maximum of the lists. Ifrobustwas passed, the defaultvminandvmaxare some percentile range of the data values. Otherwise, the defaultvminandvmaxare the minimum and maximum of the data values.N – Shorthand for
levels.levels (
intor sequence offloat, default:rc['cmap.levels']=11) – The number of level edges or a sequence of level edges. If the former,locatoris used to generate this many level edges at “nice” intervals. If the latter, the levels should be monotonically increasing or decreasing (note decreasing levels fail withcontourplots).values (
intor sequence offloat, default:None) – The number of level centers or a sequence of level centers. If the former,locatoris used to generate this many level centers at “nice” intervals. If the latter, levels are inferred usingedges. This will override anylevelsinput.center_levels (
bool, defaultFalse) – If set to true, the discrete color bar bins will be centered on the level values instead of using the level values as the edges of the discrete bins. This option can be used for diverging, discrete color bars with both positive and negative data to ensure data near zero is properly represented.robust (
bool,float, or2-tuple, default:rc['cmap.robust']=False) – IfTrueandvminorvmaxwere not provided, they are determined from the 2nd and 98th data percentiles rather than the minimum and maximum. If float, this percentile range is used (for example,90corresponds to the 5th to 95th percentiles). If 2-tuple of float, these specific percentiles should be used. This feature is useful when your data has large outliers.inbounds (
bool, default:rc['cmap.inbounds']=True) – IfTrueandvminorvmaxwere not provided, when axis limits have been explicitly restricted withset_xlim()orset_ylim(), out-of-bounds data is ignored. See alsorc['cmap.inbounds']andrc['axes.inbounds'].locator (
locator-spec, default:matplotlib.ticker.MaxNLocator) – The locator used to determine level locations iflevelsorvalueswere not already passed as lists. Passed to theLocatorconstructor. Default isMaxNLocatorwithlevelsinteger levels.locator_kw (dict-like, optional) – Keyword arguments passed to
matplotlib.ticker.Locatorclass.symmetric (
bool, default:False) – IfTrue, the normalization range or discrete colormap levels are symmetric about zero.positive (
bool, default:False) – IfTrue, the normalization range or discrete colormap levels are positive with a minimum at zero.negative (
bool, default:False) – IfTrue, the normaliation range or discrete colormap levels are negative with a minimum at zero.nozero (
bool, default:False) – IfTrue,0is removed from the level list. This is mainly useful for single-colorcontourplots.lw, linewidth, linewidths (
unit-spec, default:0.3) – The width of lines between grid boxes. If float, units are points. If string, interpreted byunits.ls, linestyle, linestyles (
str, default:'-') – The style of lines between grid boxes.ec, edgecolor, edgecolors (
color-spec, default:'k') – The color of lines between grid boxes.a, alpha, alphas (
float, optional) – The opacity of the grid boxes. Inferred fromcmapby default.edgefix (
boolorfloat, default:rc.edgefix=True) – Whether to fix the common issue where white lines appear between adjacent patches in saved vector graphics (this can slow down figure rendering). See this github repo for a demonstration of the problem. IfTrue, a small default linewidth of0.3is used to cover up the white lines. If float (e.g.edgefix=0.5), this specific linewidth is used to cover up the white lines. This feature is automatically disabled when the patches have transparency.label (
str, optional) – The legend label to be used for this object. In the case of contours, this is paired with the the central artist in the artist list returned bymatplotlib.contour.ContourSet.legend_elements.labels (
bool, optional) – Whether to apply labels to contours and grid boxes. The text will be white when the luminance of the underlying filled contour or grid box is less than 50 and black otherwise.labels_kw (dict-like, optional) – Ignored if
labelsisFalse. Extra keyword args for the labels. For contour plots, this is passed toclabel. Otherwise, this is passed totext.formatter, fmt (
formatter-spec, optional) – TheFormatterused to format number labels. Passed to theFormatterconstructor.formatter_kw (dict-like, optional) – Keyword arguments passed to
matplotlib.ticker.Formatterclass.precision (
int, optional) – The maximum number of decimal places for number labels generated with the default formatterSimpleformatter.colorbar (
bool,int, orstr, optional) – If notNone, this is a location specifying where to draw an inset or outer colorbar from the resulting object(s). IfTrue, the defaultrc['colorbar.loc']='right'is used. If the same location is used in successive plotting calls, object(s) will be added to the existing colorbar in that location (valid for colorbars built from lists of artists). Valid locations are shown in incolorbar.colorbar_kw (dict-like, optional) – Extra keyword args for the call to
colorbar.legend (
bool,int, orstr, optional) – Location specifying where to draw an inset or outer legend from the resulting object(s). IfTrue, the defaultrc['legend.loc']='best'is used. If the same location is used in successive plotting calls, object(s) will be added to existing legend in that location. Valid locations are shown inlegend().legend_kw (dict-like, optional) – Extra keyword args for the call to
legend.**kwargs – Passed to
matplotlib.axes.Axes.pcolorfast.
- pcolormesh(**kwargs)[source]
Plot regular grid boxes.
- Parameters:
*args (
zorx,y,z) – The data passed as positional or keyword arguments. Interpreted as follows:If only
zcoordinates are passed, try to infer thexandycoordinates from theDataFrameindices and columns or theDataArraycoordinates. Otherwise, theycoordinates arenp.arange(0, y.shape[0])and thexcoordinates arenp.arange(0, y.shape[1]).For
pcolorandpcolormesh, calculate coordinate edges usingedgesor:func:`~ultraplot.utils.edges2d`if centers were provided. For all other methods, calculate coordinate centers if edges were provided.If the
xorycoordinates arepint.Quantity, auto-add the pint unit registry to matplotlib’s unit registry usingsetup_matplotlib. If thezcoordinates arepint.Quantity, pass the magnitude to the plotting command. Apint.Quantityembedded in anxarray.DataArrayis also supported.
data (dict-like, optional) – A dict-like dataset container (e.g.,
DataFrameorDataset). If passed, each data argument can optionally be a stringkeyand the arrays used for plotting are retrieved withdata[key]. This is a native matplotlib feature.autoformat (
bool, default:rc.autoformat=True) – Whether thexaxis labels,yaxis labels, axis formatters, axes titles, legend titles, and colorbar labels are automatically configured when aSeries,DataFrame,DataArray, orQuantityis passed to the plotting command. Formatting ofpint.Quantityunit strings is controlled byrc.unitformat='L'.transpose (
bool, default:False) – Whether to transpose the input data. This should be used when passing datasets with column-major dimension order(x, y). Otherwise row-major dimension order(y, x)is expected.order (
{'C', 'F'}, default:'C') – Alternative totranspose.'C'corresponds to the default C-cyle row-major ordering (equivalent totranspose=False).'F'corresponds to Fortran-style column-major ordering (equivalent totranspose=True).globe (
bool, default:False) – Forultraplot.axes.GeoAxesonly. Whether to enforce global coverage. When set toTruethis does the following:Interpolates input data to the North and South poles by setting the data values at the poles to the mean from latitudes nearest each pole.
Makes meridional coverage “circular”, i.e. the last longitude coordinate equals the first longitude coordinate plus 360°.
When basemap is the backend, cycles 1D longitude vectors to fit within the map edges. For example, if the central longitude is 90°, the data is shifted so that it spans -90° to 270°.
- Other Parameters:
cmap (
colormap-spec, default:rc['cmap.sequential']='Fire'orrc['cmap.diverging']='BuRd') – The colormap specifer, passed to theColormapconstructor function. Ifrc['cmap.autodiverging']isTrueand the normalization range contains negative and positive values thenrc['cmap.diverging']is used. Otherwiserc['cmap.sequential']is used.c, color, colors (
color-specor sequence ofcolor-spec, optional) – The color(s) used to create aDiscreteColormap. If not passed,cmapis used.norm (
norm-spec, default:NormalizeorDivergingNorm) – The data value normalizer, passed to theNormconstructor function. IfdiscreteisTruethen 1) this affects the default level-generation algorithm (e.g.norm='log'builds levels in log-space) and 2) this is passed toDiscreteNormto scale the colors before they are discretized (ifnormis not already aDiscreteNorm). Ifrc['cmap.autodiverging']isTrueand the normalization range contains negative and positive values thenDivergingNormis used. OtherwiseNormalizeis used.extend (
{'neither', 'both', 'min', 'max'}, default:'neither') – Direction for drawing colorbar “extensions” indicating out-of-bounds data on the end of the colorbar.discrete (
bool, default:rc['cmap.discrete']=None) – IfFalse, thenDiscreteNormis not applied to the colormap. Instead, for non-contour plots, the number of levels will be roughly controlled byrc['cmap.lut']. This has a similar effect to usinglevels=large_numberbut it may improve rendering speed. Default isTrueonly for contouring commands likecontourfand pseudocolor commands likepcolor.sequential, diverging, cyclic, qualitative (
bool, default:None) – Boolean arguments used ifcmapis not passed. Set these toTrueto use the defaultrc['cmap.sequential'],rc['cmap.diverging'],rc['cmap.cyclic'], andrc['cmap.qualitative']colormaps. Thedivergingoption also appliesDivergingNormas the default continuous normalizer.vmin, vmax (
float, optional) – The minimum and maximum color scale values used with thenormnormalizer. IfdiscreteisFalsethese are the absolute limits, and ifdiscreteisTruethese are the approximate limits used to automatically determinelevelsorvalueslists at “nice” intervals. Iflevelsorvalueswere already passed as lists, these are ignored, andvminandvmaxare set to the minimum and maximum of the lists. Ifrobustwas passed, the defaultvminandvmaxare some percentile range of the data values. Otherwise, the defaultvminandvmaxare the minimum and maximum of the data values.N – Shorthand for
levels.levels (
intor sequence offloat, default:rc['cmap.levels']=11) – The number of level edges or a sequence of level edges. If the former,locatoris used to generate this many level edges at “nice” intervals. If the latter, the levels should be monotonically increasing or decreasing (note decreasing levels fail withcontourplots).values (
intor sequence offloat, default:None) – The number of level centers or a sequence of level centers. If the former,locatoris used to generate this many level centers at “nice” intervals. If the latter, levels are inferred usingedges. This will override anylevelsinput.center_levels (
bool, defaultFalse) – If set to true, the discrete color bar bins will be centered on the level values instead of using the level values as the edges of the discrete bins. This option can be used for diverging, discrete color bars with both positive and negative data to ensure data near zero is properly represented.robust (
bool,float, or2-tuple, default:rc['cmap.robust']=False) – IfTrueandvminorvmaxwere not provided, they are determined from the 2nd and 98th data percentiles rather than the minimum and maximum. If float, this percentile range is used (for example,90corresponds to the 5th to 95th percentiles). If 2-tuple of float, these specific percentiles should be used. This feature is useful when your data has large outliers.inbounds (
bool, default:rc['cmap.inbounds']=True) – IfTrueandvminorvmaxwere not provided, when axis limits have been explicitly restricted withset_xlim()orset_ylim(), out-of-bounds data is ignored. See alsorc['cmap.inbounds']andrc['axes.inbounds'].locator (
locator-spec, default:matplotlib.ticker.MaxNLocator) – The locator used to determine level locations iflevelsorvalueswere not already passed as lists. Passed to theLocatorconstructor. Default isMaxNLocatorwithlevelsinteger levels.locator_kw (dict-like, optional) – Keyword arguments passed to
matplotlib.ticker.Locatorclass.symmetric (
bool, default:False) – IfTrue, the normalization range or discrete colormap levels are symmetric about zero.positive (
bool, default:False) – IfTrue, the normalization range or discrete colormap levels are positive with a minimum at zero.negative (
bool, default:False) – IfTrue, the normaliation range or discrete colormap levels are negative with a minimum at zero.nozero (
bool, default:False) – IfTrue,0is removed from the level list. This is mainly useful for single-colorcontourplots.lw, linewidth, linewidths (
unit-spec, default:0.3) – The width of lines between grid boxes. If float, units are points. If string, interpreted byunits.ls, linestyle, linestyles (
str, default:'-') – The style of lines between grid boxes.ec, edgecolor, edgecolors (
color-spec, default:'k') – The color of lines between grid boxes.a, alpha, alphas (
float, optional) – The opacity of the grid boxes. Inferred fromcmapby default.edgefix (
boolorfloat, default:rc.edgefix=True) – Whether to fix the common issue where white lines appear between adjacent patches in saved vector graphics (this can slow down figure rendering). See this github repo for a demonstration of the problem. IfTrue, a small default linewidth of0.3is used to cover up the white lines. If float (e.g.edgefix=0.5), this specific linewidth is used to cover up the white lines. This feature is automatically disabled when the patches have transparency.label (
str, optional) – The legend label to be used for this object. In the case of contours, this is paired with the the central artist in the artist list returned bymatplotlib.contour.ContourSet.legend_elements.labels (
bool, optional) – Whether to apply labels to contours and grid boxes. The text will be white when the luminance of the underlying filled contour or grid box is less than 50 and black otherwise.labels_kw (dict-like, optional) – Ignored if
labelsisFalse. Extra keyword args for the labels. For contour plots, this is passed toclabel. Otherwise, this is passed totext.formatter, fmt (
formatter-spec, optional) – TheFormatterused to format number labels. Passed to theFormatterconstructor.formatter_kw (dict-like, optional) – Keyword arguments passed to
matplotlib.ticker.Formatterclass.precision (
int, optional) – The maximum number of decimal places for number labels generated with the default formatterSimpleformatter.colorbar (
bool,int, orstr, optional) – If notNone, this is a location specifying where to draw an inset or outer colorbar from the resulting object(s). IfTrue, the defaultrc['colorbar.loc']='right'is used. If the same location is used in successive plotting calls, object(s) will be added to the existing colorbar in that location (valid for colorbars built from lists of artists). Valid locations are shown in incolorbar.colorbar_kw (dict-like, optional) – Extra keyword args for the call to
colorbar.legend (
bool,int, orstr, optional) – Location specifying where to draw an inset or outer legend from the resulting object(s). IfTrue, the defaultrc['legend.loc']='best'is used. If the same location is used in successive plotting calls, object(s) will be added to existing legend in that location. Valid locations are shown inlegend().legend_kw (dict-like, optional) – Extra keyword args for the call to
legend.**kwargs – Passed to
matplotlib.axes.Axes.pcolormesh.
- pie(**kwargs)[source]
Plot a pie chart.
- Parameters:
*args (
yorx,y) – The data passed as positional or keyword arguments. Interpreted as follows:If only
ycoordinates are passed, try to infer thexcoordinates from theSeriesorDataFrameindices or theDataArraycoordinates. Otherwise, thexcoordinates arenp.arange(0, y.shape[0]).If the
ycoordinates are a 2D array, plot each column of data in succession (except where each column of data represents a statistical distribution, as withboxplot,violinplot, or when usingmeans=Trueormedians=True).If any arguments are
pint.Quantity, auto-add the pint unit registry to matplotlib’s unit registry usingsetup_matplotlib. Apint.Quantityembedded in anxarray.DataArrayis also supported.
data (dict-like, optional) – A dict-like dataset container (e.g.,
DataFrameorDataset). If passed, each data argument can optionally be a stringkeyand the arrays used for plotting are retrieved withdata[key]. This is a native matplotlib feature.autoformat (
bool, default:rc.autoformat=True) – Whether thexaxis labels,yaxis labels, axis formatters, axes titles, legend titles, and colorbar labels are automatically configured when aSeries,DataFrame,DataArray, orQuantityis passed to the plotting command. Formatting ofpint.Quantityunit strings is controlled byrc.unitformat='L'.
- Other Parameters:
cycle (
cycle-spec, optional) – The cycle specifer, passed to theCycleconstructor. If the returned cycler is unchanged from the current cycler, the axes cycler will not be reset to its first position. To disable property cycling and just use black for the default color, usecycle=False,cycle='none', orcycle=()(analogous to disabling ticks with e.g.xformatter='none'). To restore the default property cycler, usecycle=True.lw, linewidth, linewidths (
unit-spec, default:rc['patch.linewidth']=0.6) – The edge width of the patch(es). If float, units are points. If string, interpreted byunits.ls, linestyle, linestyles (
str, default:'-') – The edge style of the patch(es).ec, edgecolor, edgecolors (
color-spec, default:'none') – The edge color of the patch(es).fc, facecolor, facecolors, fillcolor, fillcolors (
color-spec, optional) – The face color of the patch(es). The propertycycleis used by default.a, alpha, alphas (
float, optional) – The opacity of the patch(es). Inferred fromfacecolorandedgecolorby default.edgefix (
boolorfloat, default:rc.edgefix=True) – Whether to fix the common issue where white lines appear between adjacent patches in saved vector graphics (this can slow down figure rendering). See this github repo for a demonstration of the problem. IfTrue, a small default linewidth of0.3is used to cover up the white lines. If float (e.g.edgefix=0.5), this specific linewidth is used to cover up the white lines. This feature is automatically disabled when the patches have transparency.label, value (
floatorstr, optional) – The single legend label or colorbar coordinate to be used for this plotted element. Can be numeric or string. This is generally used with 1D positional arguments.labels, values (sequence of
floator sequence ofstr, optional) – The legend labels or colorbar coordinates used for each plotted element. Can be numeric or string, and must match the number of plotted elements. This is generally used with 2D positional arguments.labelpad, labeldistance (
float, optional) – The distance at which labels are drawn in radial coordinates.
See also
- plot(**kwargs)[source]
Plot standard lines.
- Parameters:
*args (
yorx,y) – The data passed as positional or keyword arguments. Interpreted as follows:If only
ycoordinates are passed, try to infer thexcoordinates from theSeriesorDataFrameindices or theDataArraycoordinates. Otherwise, thexcoordinates arenp.arange(0, y.shape[0]).If the
ycoordinates are a 2D array, plot each column of data in succession (except where each column of data represents a statistical distribution, as withboxplot,violinplot, or when usingmeans=Trueormedians=True).If any arguments are
pint.Quantity, auto-add the pint unit registry to matplotlib’s unit registry usingsetup_matplotlib. Apint.Quantityembedded in anxarray.DataArrayis also supported.
data (dict-like, optional) – A dict-like dataset container (e.g.,
DataFrameorDataset). If passed, each data argument can optionally be a stringkeyand the arrays used for plotting are retrieved withdata[key]. This is a native matplotlib feature.autoformat (
bool, default:rc.autoformat=True) – Whether thexaxis labels,yaxis labels, axis formatters, axes titles, legend titles, and colorbar labels are automatically configured when aSeries,DataFrame,DataArray, orQuantityis passed to the plotting command. Formatting ofpint.Quantityunit strings is controlled byrc.unitformat='L'.
- Other Parameters:
cycle (
cycle-spec, optional) – The cycle specifer, passed to theCycleconstructor. If the returned cycler is unchanged from the current cycler, the axes cycler will not be reset to its first position. To disable property cycling and just use black for the default color, usecycle=False,cycle='none', orcycle=()(analogous to disabling ticks with e.g.xformatter='none'). To restore the default property cycler, usecycle=True.lw, linewidth, linewidths (
unit-spec, default:rc['lines.linewidth']=1.5) – The width of the line(s). If float, units are points. If string, interpreted byunits.ls, linestyle, linestyles (
str, default:rc['lines.linestyle']='-') – The style of the line(s).c, color, colors (
color-spec, optional) – The color of the line(s). The propertycycleis used by default.a, alpha, alphas (
float, optional) – The opacity of the line(s). Inferred fromcolorby default.mean, means (
bool, default:False) – Whether to plot the means of each column for 2Dycoordinates. Means are calculated withnumpy.nanmean. If no other arguments are specified, this also setsbarstd=True(andboxstd=Truefor violin plots).median, medians (
bool, default:False) – Whether to plot the medians of each column for 2Dycoordinates. Medians are calculated withnumpy.nanmedian. If no other arguments arguments are specified, this also setsbarstd=True(andboxstd=Truefor violin plots).barstd, barstds (
bool,float, or2-tupleoffloat, optional) – Valid only ifmeanormedianisTrue. Standard deviation multiples for thin error bars with optional whiskers (i.e., caps). If scalar, then +/- that multiple is used. IfTrue, the default standard deviation range of +/-3 is used.barpctile, barpctiles (
bool,float, or2-tupleoffloat, optional) – Valid only ifmeanormedianisTrue. As withbarstd, but instead using percentiles for the error bars. If scalar, that percentile range is used (e.g.,90shows the 5th to 95th percentiles). IfTrue, the default percentile range of 0 to 100 is used.bardata (array-like, optional) – Valid only if
meanandmedianareFalse. If shape is 2 x N, these are the lower and upper bounds for the thin error bars. If shape is N, these are the absolute, symmetric deviations from the central points.boxes (
bool, default:None) – Shorthand forboxstd,boxstds.boxstd, boxstds, boxpctile, boxpctiles, boxdata (optional) – As with
barstd,barpctile, andbardata, but for thicker error bars representing a smaller interval than the thin error bars. IfboxstdsisTrue, the default standard deviation range of +/-1 is used. IfboxpctilesisTrue, the default percentile range of 25 to 75 is used (i.e., the interquartile range). When “boxes” and “bars” are combined, this has the effect of drawing miniature box-and-whisker plots.capsize (
float, default:rc['errorbar.capsize']=3.0) – The cap size for thin error bars in points.barz, barzorder, boxz, boxzorder (
float, default:2.5) – The “zorder” for the thin and thick error bars.barc, barcolor, boxc, boxcolor (
color-spec, default:rc['boxplot.whiskerprops.color']='black') – Colors for the thin and thick error bars.barlw, barlinewidth, boxlw, boxlinewidth (
float, default:rc['boxplot.whiskerprops.linewidth']=1.0) – Line widths for the thin and thick error bars, in points. The default for boxes is 4 timesrc['boxplot.whiskerprops.linewidth'].boxm, boxmarker (
boolormarker-spec, default:'o') – Whether to draw a small marker in the middle of the box denoting the mean or median position. Ignored ifboxesisFalse.boxms, boxmarkersize (
size-spec, default:(2 * boxlinewidth) ** 2) – The marker size for theboxmarkermarker in points ** 2.boxmc, boxmarkercolor, boxmec, boxmarkeredgecolor (
color-spec, default:'w') – Color, face color, and edge color for theboxmarkermarker.shadestd, shadestds, shadepctile, shadepctiles, shadedata (optional) – As with
barstd,barpctile, andbardata, but using shading to indicate the error range. IfshadestdsisTrue, the default standard deviation range of +/-2 is used. IfshadepctilesisTrue, the default percentile range of 10 to 90 is used.fadestd, fadestds, fadepctile, fadepctiles, fadedata (optional) – As with
shadestd,shadepctile, andshadedata, but for an additional, more faded, secondary shaded region. IffadestdsisTrue, the default standard deviation range of +/-3 is used. IffadepctilesisTrue, the default percentile range of 0 to 100 is used.shadec, shadecolor, fadec, fadecolor (
color-spec, default:None) – Colors for the different shaded regions. The parent artist color is used by default.shadez, shadezorder, fadez, fadezorder (
float, default:1.5) – The “zorder” for the different shaded regions.shadea, shadealpha, fadea, fadealpha (
float, default:0.4,0.2) – The opacity for the different shaded regions.shadelw, shadelinewidth, fadelw, fadelinewidth (
float, default:rc['patch.linewidth']=0.6.) – The edge line width for the shading patches.shdeec, shadeedgecolor, fadeec, fadeedgecolor (
float, default:'none') – The edge color for the shading patches.shadelabel, fadelabel (
boolorstr, optional) – Labels for the shaded regions to be used as separate legend entries. To toggle labels “on” and apply a default label, use e.g.shadelabel=True. To apply a custom label, use e.g.shadelabel='label'. Otherwise, the shading is drawn underneath the line and/or marker in the legend entry.inbounds (
bool, default:rc['axes.inbounds']=True) – Whether to restrict the defaulty(x) axis limits to account for only in-bounds data when thex(y) axis limits have been locked. See alsorc['axes.inbounds']andrc['cmap.inbounds'].label, value (
floatorstr, optional) – The single legend label or colorbar coordinate to be used for this plotted element. Can be numeric or string. This is generally used with 1D positional arguments.labels, values (sequence of
floator sequence ofstr, optional) – The legend labels or colorbar coordinates used for each plotted element. Can be numeric or string, and must match the number of plotted elements. This is generally used with 2D positional arguments.colorbar (
bool,int, orstr, optional) – If notNone, this is a location specifying where to draw an inset or outer colorbar from the resulting object(s). IfTrue, the defaultrc['colorbar.loc']='right'is used. If the same location is used in successive plotting calls, object(s) will be added to the existing colorbar in that location (valid for colorbars built from lists of artists). Valid locations are shown in incolorbar.colorbar_kw (dict-like, optional) – Extra keyword args for the call to
colorbar.legend (
bool,int, orstr, optional) – Location specifying where to draw an inset or outer legend from the resulting object(s). IfTrue, the defaultrc['legend.loc']='best'is used. If the same location is used in successive plotting calls, object(s) will be added to existing legend in that location. Valid locations are shown inlegend().legend_kw (dict-like, optional) – Extra keyword args for the call to
legend.**kwargs – Passed to
plot().
See also
- plotx(*args, **kwargs)[source]
Plot standard lines.
- Parameters:
*args (
xory,x) – The data passed as positional or keyword arguments. Interpreted as follows:If only
xcoordinates are passed, try to infer theycoordinates from theSeriesorDataFrameindices or theDataArraycoordinates. Otherwise, theycoordinates arenp.arange(0, x.shape[0]).If the
xcoordinates are a 2D array, plot each column of data in succession (except where each column of data represents a statistical distribution, as withboxplot,violinplot, or when usingmeans=Trueormedians=True).If any arguments are
pint.Quantity, auto-add the pint unit registry to matplotlib’s unit registry usingsetup_matplotlib. Apint.Quantityembedded in anxarray.DataArrayis also supported.
data (dict-like, optional) – A dict-like dataset container (e.g.,
DataFrameorDataset). If passed, each data argument can optionally be a stringkeyand the arrays used for plotting are retrieved withdata[key]. This is a native matplotlib feature.autoformat (
bool, default:rc.autoformat=True) – Whether thexaxis labels,yaxis labels, axis formatters, axes titles, legend titles, and colorbar labels are automatically configured when aSeries,DataFrame,DataArray, orQuantityis passed to the plotting command. Formatting ofpint.Quantityunit strings is controlled byrc.unitformat='L'.
- Other Parameters:
cycle (
cycle-spec, optional) – The cycle specifer, passed to theCycleconstructor. If the returned cycler is unchanged from the current cycler, the axes cycler will not be reset to its first position. To disable property cycling and just use black for the default color, usecycle=False,cycle='none', orcycle=()(analogous to disabling ticks with e.g.xformatter='none'). To restore the default property cycler, usecycle=True.lw, linewidth, linewidths (
unit-spec, default:rc['lines.linewidth']=1.5) – The width of the line(s). If float, units are points. If string, interpreted byunits.ls, linestyle, linestyles (
str, default:rc['lines.linestyle']='-') – The style of the line(s).c, color, colors (
color-spec, optional) – The color of the line(s). The propertycycleis used by default.a, alpha, alphas (
float, optional) – The opacity of the line(s). Inferred fromcolorby default.mean, means (
bool, default:False) – Whether to plot the means of each column for 2Dxcoordinates. Means are calculated withnumpy.nanmean. If no other arguments are specified, this also setsbarstd=True(andboxstd=Truefor violin plots).median, medians (
bool, default:False) – Whether to plot the medians of each column for 2Dxcoordinates. Medians are calculated withnumpy.nanmedian. If no other arguments arguments are specified, this also setsbarstd=True(andboxstd=Truefor violin plots).barstd, barstds (
bool,float, or2-tupleoffloat, optional) – Valid only ifmeanormedianisTrue. Standard deviation multiples for thin error bars with optional whiskers (i.e., caps). If scalar, then +/- that multiple is used. IfTrue, the default standard deviation range of +/-3 is used.barpctile, barpctiles (
bool,float, or2-tupleoffloat, optional) – Valid only ifmeanormedianisTrue. As withbarstd, but instead using percentiles for the error bars. If scalar, that percentile range is used (e.g.,90shows the 5th to 95th percentiles). IfTrue, the default percentile range of 0 to 100 is used.bardata (array-like, optional) – Valid only if
meanandmedianareFalse. If shape is 2 x N, these are the lower and upper bounds for the thin error bars. If shape is N, these are the absolute, symmetric deviations from the central points.boxes (
bool, default:None) – Shorthand forboxstd,boxstds.boxstd, boxstds, boxpctile, boxpctiles, boxdata (optional) – As with
barstd,barpctile, andbardata, but for thicker error bars representing a smaller interval than the thin error bars. IfboxstdsisTrue, the default standard deviation range of +/-1 is used. IfboxpctilesisTrue, the default percentile range of 25 to 75 is used (i.e., the interquartile range). When “boxes” and “bars” are combined, this has the effect of drawing miniature box-and-whisker plots.capsize (
float, default:rc['errorbar.capsize']=3.0) – The cap size for thin error bars in points.barz, barzorder, boxz, boxzorder (
float, default:2.5) – The “zorder” for the thin and thick error bars.barc, barcolor, boxc, boxcolor (
color-spec, default:rc['boxplot.whiskerprops.color']='black') – Colors for the thin and thick error bars.barlw, barlinewidth, boxlw, boxlinewidth (
float, default:rc['boxplot.whiskerprops.linewidth']=1.0) – Line widths for the thin and thick error bars, in points. The default for boxes is 4 timesrc['boxplot.whiskerprops.linewidth'].boxm, boxmarker (
boolormarker-spec, default:'o') – Whether to draw a small marker in the middle of the box denoting the mean or median position. Ignored ifboxesisFalse.boxms, boxmarkersize (
size-spec, default:(2 * boxlinewidth) ** 2) – The marker size for theboxmarkermarker in points ** 2.boxmc, boxmarkercolor, boxmec, boxmarkeredgecolor (
color-spec, default:'w') – Color, face color, and edge color for theboxmarkermarker.shadestd, shadestds, shadepctile, shadepctiles, shadedata (optional) – As with
barstd,barpctile, andbardata, but using shading to indicate the error range. IfshadestdsisTrue, the default standard deviation range of +/-2 is used. IfshadepctilesisTrue, the default percentile range of 10 to 90 is used.fadestd, fadestds, fadepctile, fadepctiles, fadedata (optional) – As with
shadestd,shadepctile, andshadedata, but for an additional, more faded, secondary shaded region. IffadestdsisTrue, the default standard deviation range of +/-3 is used. IffadepctilesisTrue, the default percentile range of 0 to 100 is used.shadec, shadecolor, fadec, fadecolor (
color-spec, default:None) – Colors for the different shaded regions. The parent artist color is used by default.shadez, shadezorder, fadez, fadezorder (
float, default:1.5) – The “zorder” for the different shaded regions.shadea, shadealpha, fadea, fadealpha (
float, default:0.4,0.2) – The opacity for the different shaded regions.shadelw, shadelinewidth, fadelw, fadelinewidth (
float, default:rc['patch.linewidth']=0.6.) – The edge line width for the shading patches.shdeec, shadeedgecolor, fadeec, fadeedgecolor (
float, default:'none') – The edge color for the shading patches.shadelabel, fadelabel (
boolorstr, optional) – Labels for the shaded regions to be used as separate legend entries. To toggle labels “on” and apply a default label, use e.g.shadelabel=True. To apply a custom label, use e.g.shadelabel='label'. Otherwise, the shading is drawn underneath the line and/or marker in the legend entry.inbounds (
bool, default:rc['axes.inbounds']=True) – Whether to restrict the defaulty(x) axis limits to account for only in-bounds data when thex(y) axis limits have been locked. See alsorc['axes.inbounds']andrc['cmap.inbounds'].label, value (
floatorstr, optional) – The single legend label or colorbar coordinate to be used for this plotted element. Can be numeric or string. This is generally used with 1D positional arguments.labels, values (sequence of
floator sequence ofstr, optional) – The legend labels or colorbar coordinates used for each plotted element. Can be numeric or string, and must match the number of plotted elements. This is generally used with 2D positional arguments.colorbar (
bool,int, orstr, optional) – If notNone, this is a location specifying where to draw an inset or outer colorbar from the resulting object(s). IfTrue, the defaultrc['colorbar.loc']='right'is used. If the same location is used in successive plotting calls, object(s) will be added to the existing colorbar in that location (valid for colorbars built from lists of artists). Valid locations are shown in incolorbar.colorbar_kw (dict-like, optional) – Extra keyword args for the call to
colorbar.legend (
bool,int, orstr, optional) – Location specifying where to draw an inset or outer legend from the resulting object(s). IfTrue, the defaultrc['legend.loc']='best'is used. If the same location is used in successive plotting calls, object(s) will be added to existing legend in that location. Valid locations are shown inlegend().legend_kw (dict-like, optional) – Extra keyword args for the call to
legend.**kwargs – Passed to
plot().
See also
- quiver(**kwargs)[source]
Plot quiver arrows.
- Parameters:
*args (
u,vorx,y,u,v) – The data passed as positional or keyword arguments. Interpreted as follows:If only
uandvcoordinates are passed, try to infer thexandycoordinates from theDataFrameindices and columns or theDataArraycoordinates. Otherwise, theycoordinates arenp.arange(0, y.shape[0])and thexcoordinates arenp.arange(0, y.shape[1]).For
pcolorandpcolormesh, calculate coordinate edges usingedgesor:func:`~ultraplot.utils.edges2d`if centers were provided. For all other methods, calculate coordinate centers if edges were provided.If the
xorycoordinates arepint.Quantity, auto-add the pint unit registry to matplotlib’s unit registry usingsetup_matplotlib. If theuandvcoordinates arepint.Quantity, pass the magnitude to the plotting command. Apint.Quantityembedded in anxarray.DataArrayis also supported.
c, color, colors (array-like or
color-spec, optional) – The colors of the quiver arrows passed as either a keyword argument or a fifth positional argument. This can be a single color or a color array to be scaled bycmapandnorm.data (dict-like, optional) – A dict-like dataset container (e.g.,
DataFrameorDataset). If passed, each data argument can optionally be a stringkeyand the arrays used for plotting are retrieved withdata[key]. This is a native matplotlib feature.autoformat (
bool, default:rc.autoformat=True) – Whether thexaxis labels,yaxis labels, axis formatters, axes titles, legend titles, and colorbar labels are automatically configured when aSeries,DataFrame,DataArray, orQuantityis passed to the plotting command. Formatting ofpint.Quantityunit strings is controlled byrc.unitformat='L'.transpose (
bool, default:False) – Whether to transpose the input data. This should be used when passing datasets with column-major dimension order(x, y). Otherwise row-major dimension order(y, x)is expected.order (
{'C', 'F'}, default:'C') – Alternative totranspose.'C'corresponds to the default C-cyle row-major ordering (equivalent totranspose=False).'F'corresponds to Fortran-style column-major ordering (equivalent totranspose=True).globe (
bool, default:False) – Forultraplot.axes.GeoAxesonly. Whether to enforce global coverage. When set toTruethis does the following:Interpolates input data to the North and South poles by setting the data values at the poles to the mean from latitudes nearest each pole.
Makes meridional coverage “circular”, i.e. the last longitude coordinate equals the first longitude coordinate plus 360°.
When basemap is the backend, cycles 1D longitude vectors to fit within the map edges. For example, if the central longitude is 90°, the data is shifted so that it spans -90° to 270°.
- Other Parameters:
cmap (
colormap-spec, default:rc['cmap.sequential']='Fire'orrc['cmap.diverging']='BuRd') – The colormap specifer, passed to theColormapconstructor function. Ifrc['cmap.autodiverging']isTrueand the normalization range contains negative and positive values thenrc['cmap.diverging']is used. Otherwiserc['cmap.sequential']is used.c, color, colors (
color-specor sequence ofcolor-spec, optional) – The color(s) used to create aDiscreteColormap. If not passed,cmapis used.norm (
norm-spec, default:NormalizeorDivergingNorm) – The data value normalizer, passed to theNormconstructor function. IfdiscreteisTruethen 1) this affects the default level-generation algorithm (e.g.norm='log'builds levels in log-space) and 2) this is passed toDiscreteNormto scale the colors before they are discretized (ifnormis not already aDiscreteNorm). Ifrc['cmap.autodiverging']isTrueand the normalization range contains negative and positive values thenDivergingNormis used. OtherwiseNormalizeis used.extend (
{'neither', 'both', 'min', 'max'}, default:'neither') – Direction for drawing colorbar “extensions” indicating out-of-bounds data on the end of the colorbar.discrete (
bool, default:rc['cmap.discrete']=None) – IfFalse, thenDiscreteNormis not applied to the colormap. Instead, for non-contour plots, the number of levels will be roughly controlled byrc['cmap.lut']. This has a similar effect to usinglevels=large_numberbut it may improve rendering speed. Default isTrueonly for contouring commands likecontourfand pseudocolor commands likepcolor.sequential, diverging, cyclic, qualitative (
bool, default:None) – Boolean arguments used ifcmapis not passed. Set these toTrueto use the defaultrc['cmap.sequential'],rc['cmap.diverging'],rc['cmap.cyclic'], andrc['cmap.qualitative']colormaps. Thedivergingoption also appliesDivergingNormas the default continuous normalizer.vmin, vmax (
float, optional) – The minimum and maximum color scale values used with thenormnormalizer. IfdiscreteisFalsethese are the absolute limits, and ifdiscreteisTruethese are the approximate limits used to automatically determinelevelsorvalueslists at “nice” intervals. Iflevelsorvalueswere already passed as lists, these are ignored, andvminandvmaxare set to the minimum and maximum of the lists. Ifrobustwas passed, the defaultvminandvmaxare some percentile range of the data values. Otherwise, the defaultvminandvmaxare the minimum and maximum of the data values.N – Shorthand for
levels.levels (
intor sequence offloat, default:rc['cmap.levels']=11) – The number of level edges or a sequence of level edges. If the former,locatoris used to generate this many level edges at “nice” intervals. If the latter, the levels should be monotonically increasing or decreasing (note decreasing levels fail withcontourplots).values (
intor sequence offloat, default:None) – The number of level centers or a sequence of level centers. If the former,locatoris used to generate this many level centers at “nice” intervals. If the latter, levels are inferred usingedges. This will override anylevelsinput.center_levels (
bool, defaultFalse) – If set to true, the discrete color bar bins will be centered on the level values instead of using the level values as the edges of the discrete bins. This option can be used for diverging, discrete color bars with both positive and negative data to ensure data near zero is properly represented.robust (
bool,float, or2-tuple, default:rc['cmap.robust']=False) – IfTrueandvminorvmaxwere not provided, they are determined from the 2nd and 98th data percentiles rather than the minimum and maximum. If float, this percentile range is used (for example,90corresponds to the 5th to 95th percentiles). If 2-tuple of float, these specific percentiles should be used. This feature is useful when your data has large outliers.inbounds (
bool, default:rc['cmap.inbounds']=True) – IfTrueandvminorvmaxwere not provided, when axis limits have been explicitly restricted withset_xlim()orset_ylim(), out-of-bounds data is ignored. See alsorc['cmap.inbounds']andrc['axes.inbounds'].locator (
locator-spec, default:matplotlib.ticker.MaxNLocator) – The locator used to determine level locations iflevelsorvalueswere not already passed as lists. Passed to theLocatorconstructor. Default isMaxNLocatorwithlevelsinteger levels.locator_kw (dict-like, optional) – Keyword arguments passed to
matplotlib.ticker.Locatorclass.symmetric (
bool, default:False) – IfTrue, the normalization range or discrete colormap levels are symmetric about zero.positive (
bool, default:False) – IfTrue, the normalization range or discrete colormap levels are positive with a minimum at zero.negative (
bool, default:False) – IfTrue, the normaliation range or discrete colormap levels are negative with a minimum at zero.nozero (
bool, default:False) – IfTrue,0is removed from the level list. This is mainly useful for single-colorcontourplots.**kwargs – Passed to
matplotlib.axes.Axes.quiver
- ridgeline(data, **kwargs)[source]
Create a vertical ridgeline plot (also known as a joyplot).
Ridgeline plots visualize distributions of multiple datasets as stacked, overlapping density curves. They are useful for comparing distributions across categories or over time.
- Parameters:
data (
listof array-like) – List of distributions to plot. Each element should be an array-like object containing the data points for one distribution.labels (
listofstr, optional) – Labels for each distribution. If not provided, generates default labels.positions (array-like, optional) – Y-coordinates for positioning each ridge. If provided, enables continuous (coordinate-based) positioning mode where ridges are anchored to specific numerical coordinates along the Y-axis. If None (default), uses categorical positioning with evenly-spaced ridges.
height (
floator array-like, optional) – Height of each ridge in Y-axis units. Only used in continuous positioning mode (when positions is provided). Can be a single value applied to all ridges or an array of values (one per ridge). If None, defaults to the minimum spacing between positions divided by 2.overlap (
float, default:0.5) – Amount of overlap between ridges, from 0 (no overlap) to 1 (full overlap). Higher values create more dramatic visual overlapping. Only used in categorical positioning mode (when positions is None).kde_kw (
dict, optional) – Keyword arguments passed toscipy.stats.gaussian_kde. Common parameters include:bw_method: Bandwidth selection method (scalar, ‘scott’, ‘silverman’, or callable)weights: Array of weights for each data point
Only used when hist=False.
points (
int, default:200) – Number of evaluation points for KDE curves. Higher values create smoother curves but take longer to compute. Only used when hist=False.hist (
bool, default:False) – If True, uses histograms instead of kernel density estimation.bins (
intor sequence orstr, default:'auto') – Bin specification for histograms. Can be an integer (number of bins), a sequence defining bin edges, or a string method (‘auto’, ‘sturges’, etc.). Only used when hist=True.fill (
bool, default:True) – Whether to fill the area under each density curve.alpha (
float, default:0.7) – Transparency level for filled areas (0=transparent, 1=opaque).linewidth (
float, default:1.5) – Width of the outline for each ridge.edgecolor (
color, default:'black') – Color of the ridge outlines.facecolor (
colororlistofcolors, optional) – Fill color(s) for the ridges. If a single color, applies to all ridges. If a list, must match the number of distributions. If None, uses the current color cycle or colormap.cmap (
strorColormap, optional) – Colormap name or object to use for coloring ridges. Overridden by facecolor.
- Returns:
list– List of artist objects for each ridge (PolyCollection or Line2D).
Examples
>>> import ultraplot as uplt >>> import numpy as np >>> fig, ax = uplt.subplots() >>> data = [np.random.normal(i, 1, 1000) for i in range(5)] >>> ax.ridgeline(data, labels=[f'Group {i+1}' for i in range(5)])
>>> # With colormap >>> fig, ax = uplt.subplots() >>> ax.ridgeline(data, cmap='viridis', overlap=0.7)
>>> # With histograms instead of KDE >>> fig, ax = uplt.subplots() >>> ax.ridgeline(data, hist=True, bins=20)
>>> # Continuous positioning (e.g., at specific depths) >>> fig, ax = uplt.subplots() >>> depths = [0, 10, 25, 50, 100] # meters >>> ax.ridgeline(data, positions=depths, height=8, labels=['Surface', '10m', '25m', '50m', '100m']) >>> ax.format(ylabel='Depth (m)', xlabel='Temperature (°C)')
See also
violinplotViolin plots for distribution visualization
histHistogram for single distribution
- ridgelineh(data, **kwargs)[source]
Create a horizontal ridgeline plot (also known as a joyplot).
Ridgeline plots visualize distributions of multiple datasets as stacked, overlapping density curves. They are useful for comparing distributions across categories or over time.
- Parameters:
data (
listof array-like) – List of distributions to plot. Each element should be an array-like object containing the data points for one distribution.labels (
listofstr, optional) – Labels for each distribution. If not provided, generates default labels.positions (array-like, optional) – Y-coordinates for positioning each ridge. If provided, enables continuous (coordinate-based) positioning mode where ridges are anchored to specific numerical coordinates along the Y-axis. If None (default), uses categorical positioning with evenly-spaced ridges.
height (
floator array-like, optional) – Height of each ridge in Y-axis units. Only used in continuous positioning mode (when positions is provided). Can be a single value applied to all ridges or an array of values (one per ridge). If None, defaults to the minimum spacing between positions divided by 2.overlap (
float, default:0.5) – Amount of overlap between ridges, from 0 (no overlap) to 1 (full overlap). Higher values create more dramatic visual overlapping. Only used in categorical positioning mode (when positions is None).kde_kw (
dict, optional) – Keyword arguments passed toscipy.stats.gaussian_kde. Common parameters include:bw_method: Bandwidth selection method (scalar, ‘scott’, ‘silverman’, or callable)weights: Array of weights for each data point
Only used when hist=False.
points (
int, default:200) – Number of evaluation points for KDE curves. Higher values create smoother curves but take longer to compute. Only used when hist=False.hist (
bool, default:False) – If True, uses histograms instead of kernel density estimation.bins (
intor sequence orstr, default:'auto') – Bin specification for histograms. Can be an integer (number of bins), a sequence defining bin edges, or a string method (‘auto’, ‘sturges’, etc.). Only used when hist=True.fill (
bool, default:True) – Whether to fill the area under each density curve.alpha (
float, default:0.7) – Transparency level for filled areas (0=transparent, 1=opaque).linewidth (
float, default:1.5) – Width of the outline for each ridge.edgecolor (
color, default:'black') – Color of the ridge outlines.facecolor (
colororlistofcolors, optional) – Fill color(s) for the ridges. If a single color, applies to all ridges. If a list, must match the number of distributions. If None, uses the current color cycle or colormap.cmap (
strorColormap, optional) – Colormap name or object to use for coloring ridges. Overridden by facecolor.
- Returns:
list– List of artist objects for each ridge (PolyCollection or Line2D).
Examples
>>> import ultraplot as uplt >>> import numpy as np >>> fig, ax = uplt.subplots() >>> data = [np.random.normal(i, 1, 1000) for i in range(5)] >>> ax.ridgeline(data, labels=[f'Group {i+1}' for i in range(5)])
>>> # With colormap >>> fig, ax = uplt.subplots() >>> ax.ridgeline(data, cmap='viridis', overlap=0.7)
>>> # With histograms instead of KDE >>> fig, ax = uplt.subplots() >>> ax.ridgeline(data, hist=True, bins=20)
>>> # Continuous positioning (e.g., at specific depths) >>> fig, ax = uplt.subplots() >>> depths = [0, 10, 25, 50, 100] # meters >>> ax.ridgeline(data, positions=depths, height=8, labels=['Surface', '10m', '25m', '50m', '100m']) >>> ax.format(ylabel='Depth (m)', xlabel='Temperature (°C)')
See also
violinplotViolin plots for distribution visualization
histHistogram for single distribution
- scatter(**kwargs)[source]
Plot markers with flexible keyword arguments.
- Parameters:
*args (
yorx,y) – The data passed as positional or keyword arguments. Interpreted as follows:If only
ycoordinates are passed, try to infer thexcoordinates from theSeriesorDataFrameindices or theDataArraycoordinates. Otherwise, thexcoordinates arenp.arange(0, y.shape[0]).If the
ycoordinates are a 2D array, plot each column of data in succession (except where each column of data represents a statistical distribution, as withboxplot,violinplot, or when usingmeans=Trueormedians=True).If any arguments are
pint.Quantity, auto-add the pint unit registry to matplotlib’s unit registry usingsetup_matplotlib. Apint.Quantityembedded in anxarray.DataArrayis also supported.
s, size, ms, markersize (
floator array-like orunit-spec, optional) – The marker size area(s). If this is an array matching the shape ofxandy, the units are scaled bysminandsmax. If this contains unit string(s), it is processed byunitsand represents the width rather than area.c, color, colors, mc, markercolor, markercolors, fc, facecolor, facecolors (array-like or
color-spec, optional) – The marker color(s). If this is an array matching the shape ofxandy, the colors are generated usingcmap,norm,vmin, andvmax. Otherwise, this should be a valid matplotlib color.smin, smax (
float, optional) – The minimum and maximum marker size area in unitspoints ** 2. Ignored ifabsolute_sizeisTrue. Default value forsminis1and forsmaxis the square ofrc['lines.markersize']=6.0.area_size (
bool, default:True) – Whether the marker sizessare scaled by area or by radius. The defaultTrueis consistent with matplotlib. Whenabsolute_sizeisTrue, thesunits arepoints ** 2ifarea_sizeisTrueandpointsifarea_sizeisFalse.absolute_size (
bool, default:TrueorFalse) – Whethersshould be taken to represent “absolute” marker sizes in unitspointsorpoints ** 2or “relative” marker sizes scaled bysminandsmax. Default isTrueifsis scalar andFalseifsis array-like orsminorsmaxwere passed.vmin, vmax (
float, optional) – The minimum and maximum color scale values used with thenormnormalizer. IfdiscreteisFalsethese are the absolute limits, and ifdiscreteisTruethese are the approximate limits used to automatically determinelevelsorvalueslists at “nice” intervals. Iflevelsorvalueswere already passed as lists, these are ignored, andvminandvmaxare set to the minimum and maximum of the lists. Ifrobustwas passed, the defaultvminandvmaxare some percentile range of the data values. Otherwise, the defaultvminandvmaxare the minimum and maximum of the data values.data (dict-like, optional) – A dict-like dataset container (e.g.,
DataFrameorDataset). If passed, each data argument can optionally be a stringkeyand the arrays used for plotting are retrieved withdata[key]. This is a native matplotlib feature.autoformat (
bool, default:rc.autoformat=True) – Whether thexaxis labels,yaxis labels, axis formatters, axes titles, legend titles, and colorbar labels are automatically configured when aSeries,DataFrame,DataArray, orQuantityis passed to the plotting command. Formatting ofpint.Quantityunit strings is controlled byrc.unitformat='L'.
- Other Parameters:
cmap (
colormap-spec, default:rc['cmap.sequential']='Fire'orrc['cmap.diverging']='BuRd') – The colormap specifer, passed to theColormapconstructor function. Ifrc['cmap.autodiverging']isTrueand the normalization range contains negative and positive values thenrc['cmap.diverging']is used. Otherwiserc['cmap.sequential']is used.c, color, colors (
color-specor sequence ofcolor-spec, optional) – The color(s) used to create aDiscreteColormap. If not passed,cmapis used.norm (
norm-spec, default:NormalizeorDivergingNorm) – The data value normalizer, passed to theNormconstructor function. IfdiscreteisTruethen 1) this affects the default level-generation algorithm (e.g.norm='log'builds levels in log-space) and 2) this is passed toDiscreteNormto scale the colors before they are discretized (ifnormis not already aDiscreteNorm). Ifrc['cmap.autodiverging']isTrueand the normalization range contains negative and positive values thenDivergingNormis used. OtherwiseNormalizeis used.extend (
{'neither', 'both', 'min', 'max'}, default:'neither') – Direction for drawing colorbar “extensions” indicating out-of-bounds data on the end of the colorbar.discrete (
bool, default:rc['cmap.discrete']=None) – IfFalse, thenDiscreteNormis not applied to the colormap. Instead, for non-contour plots, the number of levels will be roughly controlled byrc['cmap.lut']. This has a similar effect to usinglevels=large_numberbut it may improve rendering speed. Default isTrueonly for contouring commands likecontourfand pseudocolor commands likepcolor.sequential, diverging, cyclic, qualitative (
bool, default:None) – Boolean arguments used ifcmapis not passed. Set these toTrueto use the defaultrc['cmap.sequential'],rc['cmap.diverging'],rc['cmap.cyclic'], andrc['cmap.qualitative']colormaps. Thedivergingoption also appliesDivergingNormas the default continuous normalizer.N – Shorthand for
levels.levels (
intor sequence offloat, default:rc['cmap.levels']=11) – The number of level edges or a sequence of level edges. If the former,locatoris used to generate this many level edges at “nice” intervals. If the latter, the levels should be monotonically increasing or decreasing (note decreasing levels fail withcontourplots).values (
intor sequence offloat, default:None) – The number of level centers or a sequence of level centers. If the former,locatoris used to generate this many level centers at “nice” intervals. If the latter, levels are inferred usingedges. This will override anylevelsinput.center_levels (
bool, defaultFalse) – If set to true, the discrete color bar bins will be centered on the level values instead of using the level values as the edges of the discrete bins. This option can be used for diverging, discrete color bars with both positive and negative data to ensure data near zero is properly represented.robust (
bool,float, or2-tuple, default:rc['cmap.robust']=False) – IfTrueandvminorvmaxwere not provided, they are determined from the 2nd and 98th data percentiles rather than the minimum and maximum. If float, this percentile range is used (for example,90corresponds to the 5th to 95th percentiles). If 2-tuple of float, these specific percentiles should be used. This feature is useful when your data has large outliers.inbounds (
bool, default:rc['cmap.inbounds']=True) – IfTrueandvminorvmaxwere not provided, when axis limits have been explicitly restricted withset_xlim()orset_ylim(), out-of-bounds data is ignored. See alsorc['cmap.inbounds']andrc['axes.inbounds'].locator (
locator-spec, default:matplotlib.ticker.MaxNLocator) – The locator used to determine level locations iflevelsorvalueswere not already passed as lists. Passed to theLocatorconstructor. Default isMaxNLocatorwithlevelsinteger levels.locator_kw (dict-like, optional) – Keyword arguments passed to
matplotlib.ticker.Locatorclass.symmetric (
bool, default:False) – IfTrue, the normalization range or discrete colormap levels are symmetric about zero.positive (
bool, default:False) – IfTrue, the normalization range or discrete colormap levels are positive with a minimum at zero.negative (
bool, default:False) – IfTrue, the normaliation range or discrete colormap levels are negative with a minimum at zero.nozero (
bool, default:False) – IfTrue,0is removed from the level list. This is mainly useful for single-colorcontourplots.cycle (
cycle-spec, optional) – The cycle specifer, passed to theCycleconstructor. If the returned cycler is unchanged from the current cycler, the axes cycler will not be reset to its first position. To disable property cycling and just use black for the default color, usecycle=False,cycle='none', orcycle=()(analogous to disabling ticks with e.g.xformatter='none'). To restore the default property cycler, usecycle=True.lw, linewidth, linewidths, mew, markeredgewidth, markeredgewidths (
floator sequence, optional) – The marker edge width(s).edgecolors, markeredgecolor, markeredgecolors (
color-specor sequence, optional) – The marker edge color(s).mean, means (
bool, default:False) – Whether to plot the means of each column for 2Dycoordinates. Means are calculated withnumpy.nanmean. If no other arguments are specified, this also setsbarstd=True(andboxstd=Truefor violin plots).median, medians (
bool, default:False) – Whether to plot the medians of each column for 2Dycoordinates. Medians are calculated withnumpy.nanmedian. If no other arguments arguments are specified, this also setsbarstd=True(andboxstd=Truefor violin plots).barstd, barstds (
bool,float, or2-tupleoffloat, optional) – Valid only ifmeanormedianisTrue. Standard deviation multiples for thin error bars with optional whiskers (i.e., caps). If scalar, then +/- that multiple is used. IfTrue, the default standard deviation range of +/-3 is used.barpctile, barpctiles (
bool,float, or2-tupleoffloat, optional) – Valid only ifmeanormedianisTrue. As withbarstd, but instead using percentiles for the error bars. If scalar, that percentile range is used (e.g.,90shows the 5th to 95th percentiles). IfTrue, the default percentile range of 0 to 100 is used.bardata (array-like, optional) – Valid only if
meanandmedianareFalse. If shape is 2 x N, these are the lower and upper bounds for the thin error bars. If shape is N, these are the absolute, symmetric deviations from the central points.boxes (
bool, default:None) – Shorthand forboxstd,boxstds.boxstd, boxstds, boxpctile, boxpctiles, boxdata (optional) – As with
barstd,barpctile, andbardata, but for thicker error bars representing a smaller interval than the thin error bars. IfboxstdsisTrue, the default standard deviation range of +/-1 is used. IfboxpctilesisTrue, the default percentile range of 25 to 75 is used (i.e., the interquartile range). When “boxes” and “bars” are combined, this has the effect of drawing miniature box-and-whisker plots.capsize (
float, default:rc['errorbar.capsize']=3.0) – The cap size for thin error bars in points.barz, barzorder, boxz, boxzorder (
float, default:2.5) – The “zorder” for the thin and thick error bars.barc, barcolor, boxc, boxcolor (
color-spec, default:rc['boxplot.whiskerprops.color']='black') – Colors for the thin and thick error bars.barlw, barlinewidth, boxlw, boxlinewidth (
float, default:rc['boxplot.whiskerprops.linewidth']=1.0) – Line widths for the thin and thick error bars, in points. The default for boxes is 4 timesrc['boxplot.whiskerprops.linewidth'].boxm, boxmarker (
boolormarker-spec, default:'o') – Whether to draw a small marker in the middle of the box denoting the mean or median position. Ignored ifboxesisFalse.boxms, boxmarkersize (
size-spec, default:(2 * boxlinewidth) ** 2) – The marker size for theboxmarkermarker in points ** 2.boxmc, boxmarkercolor, boxmec, boxmarkeredgecolor (
color-spec, default:'w') – Color, face color, and edge color for theboxmarkermarker.shadestd, shadestds, shadepctile, shadepctiles, shadedata (optional) – As with
barstd,barpctile, andbardata, but using shading to indicate the error range. IfshadestdsisTrue, the default standard deviation range of +/-2 is used. IfshadepctilesisTrue, the default percentile range of 10 to 90 is used.fadestd, fadestds, fadepctile, fadepctiles, fadedata (optional) – As with
shadestd,shadepctile, andshadedata, but for an additional, more faded, secondary shaded region. IffadestdsisTrue, the default standard deviation range of +/-3 is used. IffadepctilesisTrue, the default percentile range of 0 to 100 is used.shadec, shadecolor, fadec, fadecolor (
color-spec, default:None) – Colors for the different shaded regions. The parent artist color is used by default.shadez, shadezorder, fadez, fadezorder (
float, default:1.5) – The “zorder” for the different shaded regions.shadea, shadealpha, fadea, fadealpha (
float, default:0.4,0.2) – The opacity for the different shaded regions.shadelw, shadelinewidth, fadelw, fadelinewidth (
float, default:rc['patch.linewidth']=0.6.) – The edge line width for the shading patches.shdeec, shadeedgecolor, fadeec, fadeedgecolor (
float, default:'none') – The edge color for the shading patches.shadelabel, fadelabel (
boolorstr, optional) – Labels for the shaded regions to be used as separate legend entries. To toggle labels “on” and apply a default label, use e.g.shadelabel=True. To apply a custom label, use e.g.shadelabel='label'. Otherwise, the shading is drawn underneath the line and/or marker in the legend entry.inbounds (
bool, default:rc['axes.inbounds']=True) – Whether to restrict the defaulty(x) axis limits to account for only in-bounds data when thex(y) axis limits have been locked. See alsorc['axes.inbounds']andrc['cmap.inbounds'].label, value (
floatorstr, optional) – The single legend label or colorbar coordinate to be used for this plotted element. Can be numeric or string. This is generally used with 1D positional arguments.labels, values (sequence of
floator sequence ofstr, optional) – The legend labels or colorbar coordinates used for each plotted element. Can be numeric or string, and must match the number of plotted elements. This is generally used with 2D positional arguments.colorbar (
bool,int, orstr, optional) – If notNone, this is a location specifying where to draw an inset or outer colorbar from the resulting object(s). IfTrue, the defaultrc['colorbar.loc']='right'is used. If the same location is used in successive plotting calls, object(s) will be added to the existing colorbar in that location (valid for colorbars built from lists of artists). Valid locations are shown in incolorbar.colorbar_kw (dict-like, optional) – Extra keyword args for the call to
colorbar.legend (
bool,int, orstr, optional) – Location specifying where to draw an inset or outer legend from the resulting object(s). IfTrue, the defaultrc['legend.loc']='best'is used. If the same location is used in successive plotting calls, object(s) will be added to existing legend in that location. Valid locations are shown inlegend().legend_kw (dict-like, optional) – Extra keyword args for the call to
legend.**kwargs – Passed to
scatter.
- scatterx(*args, **kwargs)[source]
Plot markers with flexible keyword arguments.
- Parameters:
*args (
xory,x) – The data passed as positional or keyword arguments. Interpreted as follows:If only
xcoordinates are passed, try to infer theycoordinates from theSeriesorDataFrameindices or theDataArraycoordinates. Otherwise, theycoordinates arenp.arange(0, x.shape[0]).If the
xcoordinates are a 2D array, plot each column of data in succession (except where each column of data represents a statistical distribution, as withboxplot,violinplot, or when usingmeans=Trueormedians=True).If any arguments are
pint.Quantity, auto-add the pint unit registry to matplotlib’s unit registry usingsetup_matplotlib. Apint.Quantityembedded in anxarray.DataArrayis also supported.
s, size, ms, markersize (
floator array-like orunit-spec, optional) – The marker size area(s). If this is an array matching the shape ofxandy, the units are scaled bysminandsmax. If this contains unit string(s), it is processed byunitsand represents the width rather than area.c, color, colors, mc, markercolor, markercolors, fc, facecolor, facecolors (array-like or
color-spec, optional) – The marker color(s). If this is an array matching the shape ofxandy, the colors are generated usingcmap,norm,vmin, andvmax. Otherwise, this should be a valid matplotlib color.smin, smax (
float, optional) – The minimum and maximum marker size area in unitspoints ** 2. Ignored ifabsolute_sizeisTrue. Default value forsminis1and forsmaxis the square ofrc['lines.markersize']=6.0.area_size (
bool, default:True) – Whether the marker sizessare scaled by area or by radius. The defaultTrueis consistent with matplotlib. Whenabsolute_sizeisTrue, thesunits arepoints ** 2ifarea_sizeisTrueandpointsifarea_sizeisFalse.absolute_size (
bool, default:TrueorFalse) – Whethersshould be taken to represent “absolute” marker sizes in unitspointsorpoints ** 2or “relative” marker sizes scaled bysminandsmax. Default isTrueifsis scalar andFalseifsis array-like orsminorsmaxwere passed.vmin, vmax (
float, optional) – The minimum and maximum color scale values used with thenormnormalizer. IfdiscreteisFalsethese are the absolute limits, and ifdiscreteisTruethese are the approximate limits used to automatically determinelevelsorvalueslists at “nice” intervals. Iflevelsorvalueswere already passed as lists, these are ignored, andvminandvmaxare set to the minimum and maximum of the lists. Ifrobustwas passed, the defaultvminandvmaxare some percentile range of the data values. Otherwise, the defaultvminandvmaxare the minimum and maximum of the data values.data (dict-like, optional) – A dict-like dataset container (e.g.,
DataFrameorDataset). If passed, each data argument can optionally be a stringkeyand the arrays used for plotting are retrieved withdata[key]. This is a native matplotlib feature.autoformat (
bool, default:rc.autoformat=True) – Whether thexaxis labels,yaxis labels, axis formatters, axes titles, legend titles, and colorbar labels are automatically configured when aSeries,DataFrame,DataArray, orQuantityis passed to the plotting command. Formatting ofpint.Quantityunit strings is controlled byrc.unitformat='L'.
- Other Parameters:
cmap (
colormap-spec, default:rc['cmap.sequential']='Fire'orrc['cmap.diverging']='BuRd') – The colormap specifer, passed to theColormapconstructor function. Ifrc['cmap.autodiverging']isTrueand the normalization range contains negative and positive values thenrc['cmap.diverging']is used. Otherwiserc['cmap.sequential']is used.c, color, colors (
color-specor sequence ofcolor-spec, optional) – The color(s) used to create aDiscreteColormap. If not passed,cmapis used.norm (
norm-spec, default:NormalizeorDivergingNorm) – The data value normalizer, passed to theNormconstructor function. IfdiscreteisTruethen 1) this affects the default level-generation algorithm (e.g.norm='log'builds levels in log-space) and 2) this is passed toDiscreteNormto scale the colors before they are discretized (ifnormis not already aDiscreteNorm). Ifrc['cmap.autodiverging']isTrueand the normalization range contains negative and positive values thenDivergingNormis used. OtherwiseNormalizeis used.extend (
{'neither', 'both', 'min', 'max'}, default:'neither') – Direction for drawing colorbar “extensions” indicating out-of-bounds data on the end of the colorbar.discrete (
bool, default:rc['cmap.discrete']=None) – IfFalse, thenDiscreteNormis not applied to the colormap. Instead, for non-contour plots, the number of levels will be roughly controlled byrc['cmap.lut']. This has a similar effect to usinglevels=large_numberbut it may improve rendering speed. Default isTrueonly for contouring commands likecontourfand pseudocolor commands likepcolor.sequential, diverging, cyclic, qualitative (
bool, default:None) – Boolean arguments used ifcmapis not passed. Set these toTrueto use the defaultrc['cmap.sequential'],rc['cmap.diverging'],rc['cmap.cyclic'], andrc['cmap.qualitative']colormaps. Thedivergingoption also appliesDivergingNormas the default continuous normalizer.N – Shorthand for
levels.levels (
intor sequence offloat, default:rc['cmap.levels']=11) – The number of level edges or a sequence of level edges. If the former,locatoris used to generate this many level edges at “nice” intervals. If the latter, the levels should be monotonically increasing or decreasing (note decreasing levels fail withcontourplots).values (
intor sequence offloat, default:None) – The number of level centers or a sequence of level centers. If the former,locatoris used to generate this many level centers at “nice” intervals. If the latter, levels are inferred usingedges. This will override anylevelsinput.center_levels (
bool, defaultFalse) – If set to true, the discrete color bar bins will be centered on the level values instead of using the level values as the edges of the discrete bins. This option can be used for diverging, discrete color bars with both positive and negative data to ensure data near zero is properly represented.robust (
bool,float, or2-tuple, default:rc['cmap.robust']=False) – IfTrueandvminorvmaxwere not provided, they are determined from the 2nd and 98th data percentiles rather than the minimum and maximum. If float, this percentile range is used (for example,90corresponds to the 5th to 95th percentiles). If 2-tuple of float, these specific percentiles should be used. This feature is useful when your data has large outliers.inbounds (
bool, default:rc['cmap.inbounds']=True) – IfTrueandvminorvmaxwere not provided, when axis limits have been explicitly restricted withset_xlim()orset_ylim(), out-of-bounds data is ignored. See alsorc['cmap.inbounds']andrc['axes.inbounds'].locator (
locator-spec, default:matplotlib.ticker.MaxNLocator) – The locator used to determine level locations iflevelsorvalueswere not already passed as lists. Passed to theLocatorconstructor. Default isMaxNLocatorwithlevelsinteger levels.locator_kw (dict-like, optional) – Keyword arguments passed to
matplotlib.ticker.Locatorclass.symmetric (
bool, default:False) – IfTrue, the normalization range or discrete colormap levels are symmetric about zero.positive (
bool, default:False) – IfTrue, the normalization range or discrete colormap levels are positive with a minimum at zero.negative (
bool, default:False) – IfTrue, the normaliation range or discrete colormap levels are negative with a minimum at zero.nozero (
bool, default:False) – IfTrue,0is removed from the level list. This is mainly useful for single-colorcontourplots.cycle (
cycle-spec, optional) – The cycle specifer, passed to theCycleconstructor. If the returned cycler is unchanged from the current cycler, the axes cycler will not be reset to its first position. To disable property cycling and just use black for the default color, usecycle=False,cycle='none', orcycle=()(analogous to disabling ticks with e.g.xformatter='none'). To restore the default property cycler, usecycle=True.lw, linewidth, linewidths, mew, markeredgewidth, markeredgewidths (
floator sequence, optional) – The marker edge width(s).edgecolors, markeredgecolor, markeredgecolors (
color-specor sequence, optional) – The marker edge color(s).mean, means (
bool, default:False) – Whether to plot the means of each column for 2Dxcoordinates. Means are calculated withnumpy.nanmean. If no other arguments are specified, this also setsbarstd=True(andboxstd=Truefor violin plots).median, medians (
bool, default:False) – Whether to plot the medians of each column for 2Dxcoordinates. Medians are calculated withnumpy.nanmedian. If no other arguments arguments are specified, this also setsbarstd=True(andboxstd=Truefor violin plots).barstd, barstds (
bool,float, or2-tupleoffloat, optional) – Valid only ifmeanormedianisTrue. Standard deviation multiples for thin error bars with optional whiskers (i.e., caps). If scalar, then +/- that multiple is used. IfTrue, the default standard deviation range of +/-3 is used.barpctile, barpctiles (
bool,float, or2-tupleoffloat, optional) – Valid only ifmeanormedianisTrue. As withbarstd, but instead using percentiles for the error bars. If scalar, that percentile range is used (e.g.,90shows the 5th to 95th percentiles). IfTrue, the default percentile range of 0 to 100 is used.bardata (array-like, optional) – Valid only if
meanandmedianareFalse. If shape is 2 x N, these are the lower and upper bounds for the thin error bars. If shape is N, these are the absolute, symmetric deviations from the central points.boxes (
bool, default:None) – Shorthand forboxstd,boxstds.boxstd, boxstds, boxpctile, boxpctiles, boxdata (optional) – As with
barstd,barpctile, andbardata, but for thicker error bars representing a smaller interval than the thin error bars. IfboxstdsisTrue, the default standard deviation range of +/-1 is used. IfboxpctilesisTrue, the default percentile range of 25 to 75 is used (i.e., the interquartile range). When “boxes” and “bars” are combined, this has the effect of drawing miniature box-and-whisker plots.capsize (
float, default:rc['errorbar.capsize']=3.0) – The cap size for thin error bars in points.barz, barzorder, boxz, boxzorder (
float, default:2.5) – The “zorder” for the thin and thick error bars.barc, barcolor, boxc, boxcolor (
color-spec, default:rc['boxplot.whiskerprops.color']='black') – Colors for the thin and thick error bars.barlw, barlinewidth, boxlw, boxlinewidth (
float, default:rc['boxplot.whiskerprops.linewidth']=1.0) – Line widths for the thin and thick error bars, in points. The default for boxes is 4 timesrc['boxplot.whiskerprops.linewidth'].boxm, boxmarker (
boolormarker-spec, default:'o') – Whether to draw a small marker in the middle of the box denoting the mean or median position. Ignored ifboxesisFalse.boxms, boxmarkersize (
size-spec, default:(2 * boxlinewidth) ** 2) – The marker size for theboxmarkermarker in points ** 2.boxmc, boxmarkercolor, boxmec, boxmarkeredgecolor (
color-spec, default:'w') – Color, face color, and edge color for theboxmarkermarker.shadestd, shadestds, shadepctile, shadepctiles, shadedata (optional) – As with
barstd,barpctile, andbardata, but using shading to indicate the error range. IfshadestdsisTrue, the default standard deviation range of +/-2 is used. IfshadepctilesisTrue, the default percentile range of 10 to 90 is used.fadestd, fadestds, fadepctile, fadepctiles, fadedata (optional) – As with
shadestd,shadepctile, andshadedata, but for an additional, more faded, secondary shaded region. IffadestdsisTrue, the default standard deviation range of +/-3 is used. IffadepctilesisTrue, the default percentile range of 0 to 100 is used.shadec, shadecolor, fadec, fadecolor (
color-spec, default:None) – Colors for the different shaded regions. The parent artist color is used by default.shadez, shadezorder, fadez, fadezorder (
float, default:1.5) – The “zorder” for the different shaded regions.shadea, shadealpha, fadea, fadealpha (
float, default:0.4,0.2) – The opacity for the different shaded regions.shadelw, shadelinewidth, fadelw, fadelinewidth (
float, default:rc['patch.linewidth']=0.6.) – The edge line width for the shading patches.shdeec, shadeedgecolor, fadeec, fadeedgecolor (
float, default:'none') – The edge color for the shading patches.shadelabel, fadelabel (
boolorstr, optional) – Labels for the shaded regions to be used as separate legend entries. To toggle labels “on” and apply a default label, use e.g.shadelabel=True. To apply a custom label, use e.g.shadelabel='label'. Otherwise, the shading is drawn underneath the line and/or marker in the legend entry.inbounds (
bool, default:rc['axes.inbounds']=True) – Whether to restrict the defaulty(x) axis limits to account for only in-bounds data when thex(y) axis limits have been locked. See alsorc['axes.inbounds']andrc['cmap.inbounds'].label, value (
floatorstr, optional) – The single legend label or colorbar coordinate to be used for this plotted element. Can be numeric or string. This is generally used with 1D positional arguments.labels, values (sequence of
floator sequence ofstr, optional) – The legend labels or colorbar coordinates used for each plotted element. Can be numeric or string, and must match the number of plotted elements. This is generally used with 2D positional arguments.colorbar (
bool,int, orstr, optional) – If notNone, this is a location specifying where to draw an inset or outer colorbar from the resulting object(s). IfTrue, the defaultrc['colorbar.loc']='right'is used. If the same location is used in successive plotting calls, object(s) will be added to the existing colorbar in that location (valid for colorbars built from lists of artists). Valid locations are shown in incolorbar.colorbar_kw (dict-like, optional) – Extra keyword args for the call to
colorbar.legend (
bool,int, orstr, optional) – Location specifying where to draw an inset or outer legend from the resulting object(s). IfTrue, the defaultrc['legend.loc']='best'is used. If the same location is used in successive plotting calls, object(s) will be added to existing legend in that location. Valid locations are shown inlegend().legend_kw (dict-like, optional) – Extra keyword args for the call to
legend.**kwargs – Passed to
scatter.
- semilogx(*args, **kwargs)[source]
Plot semilogx
UltraPlot is optimized for visualizing logarithmic scales by default. For cases with large differences in magnitude, we recommend setting
rc["formatter.log"] = Trueto enhance axis label formatting. Make a plot with log scaling on the x-axis.Call signatures:
semilogx([x], y, [fmt], data=None, **kwargs) semilogx([x], y, [fmt], [x2], y2, [fmt2], ..., **kwargs)
This is just a thin wrapper around
plotwhich additionally changes the x-axis to log scaling. All the concepts and parameters of plot can be used here as well.The additional parameters base, subs, and nonpositive control the x-axis properties. They are just forwarded to
Axes.set_xscale.- Parameters:
base (
float, default:10) – Base of the x logarithm.subs (array-like, optional) – The location of the minor xticks. If None, reasonable locations are automatically chosen depending on the number of decades in the plot. See
Axes.set_xscalefor details.nonpositive (
{'mask', 'clip'}, default:'clip') – Non-positive values in x can be masked as invalid, or clipped to a very small positive number.**kwargs – All parameters supported by
plot.
- Returns:
listofLine2D– Objects representing the plotted data.
Notes
Note
This is the pyplot wrapper for
axes.Axes.semilogx.
- semilogy(*args, **kwargs)[source]
Plot semilogy
UltraPlot is optimized for visualizing logarithmic scales by default. For cases with large differences in magnitude, we recommend setting
rc["formatter.log"] = Trueto enhance axis label formatting. Make a plot with log scaling on the y-axis.Call signatures:
semilogy([x], y, [fmt], data=None, **kwargs) semilogy([x], y, [fmt], [x2], y2, [fmt2], ..., **kwargs)
This is just a thin wrapper around
plotwhich additionally changes the y-axis to log scaling. All the concepts and parameters of plot can be used here as well.The additional parameters base, subs, and nonpositive control the y-axis properties. They are just forwarded to
Axes.set_yscale.- Parameters:
base (
float, default:10) – Base of the y logarithm.subs (array-like, optional) – The location of the minor yticks. If None, reasonable locations are automatically chosen depending on the number of decades in the plot. See
Axes.set_yscalefor details.nonpositive (
{'mask', 'clip'}, default:'clip') – Non-positive values in y can be masked as invalid, or clipped to a very small positive number.**kwargs – All parameters supported by
plot.
- Returns:
listofLine2D– Objects representing the plotted data.
Notes
Note
This is the pyplot wrapper for
axes.Axes.semilogy.
- set(*, adjustable=<UNSET>, agg_filter=<UNSET>, alpha=<UNSET>, anchor=<UNSET>, animated=<UNSET>, aspect=<UNSET>, autoscale_on=<UNSET>, autoscalex_on=<UNSET>, autoscaley_on=<UNSET>, axes_locator=<UNSET>, axisbelow=<UNSET>, box_aspect=<UNSET>, clip_box=<UNSET>, clip_on=<UNSET>, clip_path=<UNSET>, external=<UNSET>, facecolor=<UNSET>, forward_navigation_events=<UNSET>, frame_on=<UNSET>, gid=<UNSET>, in_layout=<UNSET>, label=<UNSET>, mouseover=<UNSET>, navigate=<UNSET>, path_effects=<UNSET>, picker=<UNSET>, position=<UNSET>, prop_cycle=<UNSET>, rasterization_zorder=<UNSET>, rasterized=<UNSET>, sketch_params=<UNSET>, snap=<UNSET>, subplotspec=<UNSET>, title=<UNSET>, transform=<UNSET>, url=<UNSET>, visible=<UNSET>, xbound=<UNSET>, xlabel=<UNSET>, xlim=<UNSET>, xmargin=<UNSET>, xscale=<UNSET>, xticklabels=<UNSET>, xticks=<UNSET>, ybound=<UNSET>, ylabel=<UNSET>, ylim=<UNSET>, ymargin=<UNSET>, yscale=<UNSET>, yticklabels=<UNSET>, yticks=<UNSET>, zorder=<UNSET>)
Set multiple properties at once.
Supported properties are
Property
Description
{‘box’, ‘datalim’}
a filter function, which takes a (m, n, 3) float array and a dpi value, and returns a (m, n, 3) array and two offsets from the bottom left corner of the image
float or None
(float, float) or {‘C’, ‘SW’, ‘S’, ‘SE’, ‘E’, ‘NE’, …}
bool
{‘auto’, ‘equal’} or float
bool
unknown
unknown
Callable[[Axes, Renderer], Bbox]
bool or ‘line’
float or None
BboxBaseor Nonebool
Patch or (Path, Transform) or None
externalunknown
bool or “auto”
bool
str
bool
object
bool
bool
unknown
list of
AbstractPathEffectNone or bool or float or callable
[left, bottom, width, height] or
Bboxfloat or None
bool
(scale: float, length: float, randomness: float)
bool or None
unknown
str
str
bool
(lower: float, upper: float)
str
(left: float, right: float)
float greater than -0.5
unknown
unknown
unknown
(lower: float, upper: float)
str
(bottom: float, top: float)
float greater than -0.5
unknown
unknown
unknown
float
- spy(**kwargs)[source]
Plot a sparcity pattern.
- Parameters:
z (array-like) – The data passed as a positional argument or keyword argument.
data (dict-like, optional) – A dict-like dataset container (e.g.,
DataFrameorDataset). If passed, each data argument can optionally be a stringkeyand the arrays used for plotting are retrieved withdata[key]. This is a native matplotlib feature.autoformat (
bool, default:rc.autoformat=True) – Whether thexaxis labels,yaxis labels, axis formatters, axes titles, legend titles, and colorbar labels are automatically configured when aSeries,DataFrame,DataArray, orQuantityis passed to the plotting command. Formatting ofpint.Quantityunit strings is controlled byrc.unitformat='L'.
- Other Parameters:
cmap (
colormap-spec, default:rc['cmap.sequential']='Fire'orrc['cmap.diverging']='BuRd') – The colormap specifer, passed to theColormapconstructor function. Ifrc['cmap.autodiverging']isTrueand the normalization range contains negative and positive values thenrc['cmap.diverging']is used. Otherwiserc['cmap.sequential']is used.c, color, colors (
color-specor sequence ofcolor-spec, optional) – The color(s) used to create aDiscreteColormap. If not passed,cmapis used.norm (
norm-spec, default:NormalizeorDivergingNorm) – The data value normalizer, passed to theNormconstructor function. IfdiscreteisTruethen 1) this affects the default level-generation algorithm (e.g.norm='log'builds levels in log-space) and 2) this is passed toDiscreteNormto scale the colors before they are discretized (ifnormis not already aDiscreteNorm). Ifrc['cmap.autodiverging']isTrueand the normalization range contains negative and positive values thenDivergingNormis used. OtherwiseNormalizeis used.extend (
{'neither', 'both', 'min', 'max'}, default:'neither') – Direction for drawing colorbar “extensions” indicating out-of-bounds data on the end of the colorbar.discrete (
bool, default:rc['cmap.discrete']=None) – IfFalse, thenDiscreteNormis not applied to the colormap. Instead, for non-contour plots, the number of levels will be roughly controlled byrc['cmap.lut']. This has a similar effect to usinglevels=large_numberbut it may improve rendering speed. Default isTrueonly for contouring commands likecontourfand pseudocolor commands likepcolor.sequential, diverging, cyclic, qualitative (
bool, default:None) – Boolean arguments used ifcmapis not passed. Set these toTrueto use the defaultrc['cmap.sequential'],rc['cmap.diverging'],rc['cmap.cyclic'], andrc['cmap.qualitative']colormaps. Thedivergingoption also appliesDivergingNormas the default continuous normalizer.vmin, vmax (
float, optional) – The minimum and maximum color scale values used with thenormnormalizer. IfdiscreteisFalsethese are the absolute limits, and ifdiscreteisTruethese are the approximate limits used to automatically determinelevelsorvalueslists at “nice” intervals. Iflevelsorvalueswere already passed as lists, these are ignored, andvminandvmaxare set to the minimum and maximum of the lists. Ifrobustwas passed, the defaultvminandvmaxare some percentile range of the data values. Otherwise, the defaultvminandvmaxare the minimum and maximum of the data values.N – Shorthand for
levels.levels (
intor sequence offloat, default:rc['cmap.levels']=11) – The number of level edges or a sequence of level edges. If the former,locatoris used to generate this many level edges at “nice” intervals. If the latter, the levels should be monotonically increasing or decreasing (note decreasing levels fail withcontourplots).values (
intor sequence offloat, default:None) – The number of level centers or a sequence of level centers. If the former,locatoris used to generate this many level centers at “nice” intervals. If the latter, levels are inferred usingedges. This will override anylevelsinput.center_levels (
bool, defaultFalse) – If set to true, the discrete color bar bins will be centered on the level values instead of using the level values as the edges of the discrete bins. This option can be used for diverging, discrete color bars with both positive and negative data to ensure data near zero is properly represented.robust (
bool,float, or2-tuple, default:rc['cmap.robust']=False) – IfTrueandvminorvmaxwere not provided, they are determined from the 2nd and 98th data percentiles rather than the minimum and maximum. If float, this percentile range is used (for example,90corresponds to the 5th to 95th percentiles). If 2-tuple of float, these specific percentiles should be used. This feature is useful when your data has large outliers.inbounds (
bool, default:rc['cmap.inbounds']=True) – IfTrueandvminorvmaxwere not provided, when axis limits have been explicitly restricted withset_xlim()orset_ylim(), out-of-bounds data is ignored. See alsorc['cmap.inbounds']andrc['axes.inbounds'].locator (
locator-spec, default:matplotlib.ticker.MaxNLocator) – The locator used to determine level locations iflevelsorvalueswere not already passed as lists. Passed to theLocatorconstructor. Default isMaxNLocatorwithlevelsinteger levels.locator_kw (dict-like, optional) – Keyword arguments passed to
matplotlib.ticker.Locatorclass.symmetric (
bool, default:False) – IfTrue, the normalization range or discrete colormap levels are symmetric about zero.positive (
bool, default:False) – IfTrue, the normalization range or discrete colormap levels are positive with a minimum at zero.negative (
bool, default:False) – IfTrue, the normaliation range or discrete colormap levels are negative with a minimum at zero.nozero (
bool, default:False) – IfTrue,0is removed from the level list. This is mainly useful for single-colorcontourplots.colorbar (
bool,int, orstr, optional) – If notNone, this is a location specifying where to draw an inset or outer colorbar from the resulting object(s). IfTrue, the defaultrc['colorbar.loc']='right'is used. If the same location is used in successive plotting calls, object(s) will be added to the existing colorbar in that location (valid for colorbars built from lists of artists). Valid locations are shown in incolorbar.colorbar_kw (dict-like, optional) – Extra keyword args for the call to
colorbar.legend (
bool,int, orstr, optional) – Location specifying where to draw an inset or outer legend from the resulting object(s). IfTrue, the defaultrc['legend.loc']='best'is used. If the same location is used in successive plotting calls, object(s) will be added to existing legend in that location. Valid locations are shown inlegend().legend_kw (dict-like, optional) – Extra keyword args for the call to
legend.**kwargs – Passed to
matplotlib.axes.Axes.spy.
- stem(**kwargs)[source]
Plot stem lines.
- Parameters:
*args (
xory,x) – The data passed as positional or keyword arguments. Interpreted as follows:If only
xcoordinates are passed, try to infer theycoordinates from theSeriesorDataFrameindices or theDataArraycoordinates. Otherwise, theycoordinates arenp.arange(0, x.shape[0]).If the
xcoordinates are a 2D array, plot each column of data in succession (except where each column of data represents a statistical distribution, as withboxplot,violinplot, or when usingmeans=Trueormedians=True).If any arguments are
pint.Quantity, auto-add the pint unit registry to matplotlib’s unit registry usingsetup_matplotlib. Apint.Quantityembedded in anxarray.DataArrayis also supported.
data (dict-like, optional) – A dict-like dataset container (e.g.,
DataFrameorDataset). If passed, each data argument can optionally be a stringkeyand the arrays used for plotting are retrieved withdata[key]. This is a native matplotlib feature.autoformat (
bool, default:rc.autoformat=True) – Whether thexaxis labels,yaxis labels, axis formatters, axes titles, legend titles, and colorbar labels are automatically configured when aSeries,DataFrame,DataArray, orQuantityis passed to the plotting command. Formatting ofpint.Quantityunit strings is controlled byrc.unitformat='L'.
- Other Parameters:
cycle (
cycle-spec, optional) – The cycle specifer, passed to theCycleconstructor. If the returned cycler is unchanged from the current cycler, the axes cycler will not be reset to its first position. To disable property cycling and just use black for the default color, usecycle=False,cycle='none', orcycle=()(analogous to disabling ticks with e.g.xformatter='none'). To restore the default property cycler, usecycle=True.inbounds (
bool, default:rc['axes.inbounds']=True) – Whether to restrict the defaulty(x) axis limits to account for only in-bounds data when thex(y) axis limits have been locked. See alsorc['axes.inbounds']andrc['cmap.inbounds'].colorbar (
bool,int, orstr, optional) – If notNone, this is a location specifying where to draw an inset or outer colorbar from the resulting object(s). IfTrue, the defaultrc['colorbar.loc']='right'is used. If the same location is used in successive plotting calls, object(s) will be added to the existing colorbar in that location (valid for colorbars built from lists of artists). Valid locations are shown in incolorbar.colorbar_kw (dict-like, optional) – Extra keyword args for the call to
colorbar.legend (
bool,int, orstr, optional) – Location specifying where to draw an inset or outer legend from the resulting object(s). IfTrue, the defaultrc['legend.loc']='best'is used. If the same location is used in successive plotting calls, object(s) will be added to existing legend in that location. Valid locations are shown inlegend().legend_kw (dict-like, optional) – Extra keyword args for the call to
legend.**kwargs – Passed to
stem.
- stemx(*args, **kwargs)[source]
Plot stem lines.
- Parameters:
*args (
xory,x) – The data passed as positional or keyword arguments. Interpreted as follows:If only
xcoordinates are passed, try to infer theycoordinates from theSeriesorDataFrameindices or theDataArraycoordinates. Otherwise, theycoordinates arenp.arange(0, x.shape[0]).If the
xcoordinates are a 2D array, plot each column of data in succession (except where each column of data represents a statistical distribution, as withboxplot,violinplot, or when usingmeans=Trueormedians=True).If any arguments are
pint.Quantity, auto-add the pint unit registry to matplotlib’s unit registry usingsetup_matplotlib. Apint.Quantityembedded in anxarray.DataArrayis also supported.
data (dict-like, optional) – A dict-like dataset container (e.g.,
DataFrameorDataset). If passed, each data argument can optionally be a stringkeyand the arrays used for plotting are retrieved withdata[key]. This is a native matplotlib feature.autoformat (
bool, default:rc.autoformat=True) – Whether thexaxis labels,yaxis labels, axis formatters, axes titles, legend titles, and colorbar labels are automatically configured when aSeries,DataFrame,DataArray, orQuantityis passed to the plotting command. Formatting ofpint.Quantityunit strings is controlled byrc.unitformat='L'.
- Other Parameters:
cycle (
cycle-spec, optional) – The cycle specifer, passed to theCycleconstructor. If the returned cycler is unchanged from the current cycler, the axes cycler will not be reset to its first position. To disable property cycling and just use black for the default color, usecycle=False,cycle='none', orcycle=()(analogous to disabling ticks with e.g.xformatter='none'). To restore the default property cycler, usecycle=True.inbounds (
bool, default:rc['axes.inbounds']=True) – Whether to restrict the defaulty(x) axis limits to account for only in-bounds data when thex(y) axis limits have been locked. See alsorc['axes.inbounds']andrc['cmap.inbounds'].colorbar (
bool,int, orstr, optional) – If notNone, this is a location specifying where to draw an inset or outer colorbar from the resulting object(s). IfTrue, the defaultrc['colorbar.loc']='right'is used. If the same location is used in successive plotting calls, object(s) will be added to the existing colorbar in that location (valid for colorbars built from lists of artists). Valid locations are shown in incolorbar.colorbar_kw (dict-like, optional) – Extra keyword args for the call to
colorbar.legend (
bool,int, orstr, optional) – Location specifying where to draw an inset or outer legend from the resulting object(s). IfTrue, the defaultrc['legend.loc']='best'is used. If the same location is used in successive plotting calls, object(s) will be added to existing legend in that location. Valid locations are shown inlegend().legend_kw (dict-like, optional) – Extra keyword args for the call to
legend.**kwargs – Passed to
stem.
- step(**kwargs)[source]
Plot step lines.
- Parameters:
*args (
yorx,y) – The data passed as positional or keyword arguments. Interpreted as follows:If only
ycoordinates are passed, try to infer thexcoordinates from theSeriesorDataFrameindices or theDataArraycoordinates. Otherwise, thexcoordinates arenp.arange(0, y.shape[0]).If the
ycoordinates are a 2D array, plot each column of data in succession (except where each column of data represents a statistical distribution, as withboxplot,violinplot, or when usingmeans=Trueormedians=True).If any arguments are
pint.Quantity, auto-add the pint unit registry to matplotlib’s unit registry usingsetup_matplotlib. Apint.Quantityembedded in anxarray.DataArrayis also supported.
data (dict-like, optional) – A dict-like dataset container (e.g.,
DataFrameorDataset). If passed, each data argument can optionally be a stringkeyand the arrays used for plotting are retrieved withdata[key]. This is a native matplotlib feature.autoformat (
bool, default:rc.autoformat=True) – Whether thexaxis labels,yaxis labels, axis formatters, axes titles, legend titles, and colorbar labels are automatically configured when aSeries,DataFrame,DataArray, orQuantityis passed to the plotting command. Formatting ofpint.Quantityunit strings is controlled byrc.unitformat='L'.
- Other Parameters:
cycle (
cycle-spec, optional) – The cycle specifer, passed to theCycleconstructor. If the returned cycler is unchanged from the current cycler, the axes cycler will not be reset to its first position. To disable property cycling and just use black for the default color, usecycle=False,cycle='none', orcycle=()(analogous to disabling ticks with e.g.xformatter='none'). To restore the default property cycler, usecycle=True.lw, linewidth, linewidths (
unit-spec, default:rc['lines.linewidth']=1.5) – The width of the line(s). If float, units are points. If string, interpreted byunits.ls, linestyle, linestyles (
str, default:rc['lines.linestyle']='-') – The style of the line(s).c, color, colors (
color-spec, optional) – The color of the line(s). The propertycycleis used by default.a, alpha, alphas (
float, optional) – The opacity of the line(s). Inferred fromcolorby default.inbounds (
bool, default:rc['axes.inbounds']=True) – Whether to restrict the defaulty(x) axis limits to account for only in-bounds data when thex(y) axis limits have been locked. See alsorc['axes.inbounds']andrc['cmap.inbounds'].label, value (
floatorstr, optional) – The single legend label or colorbar coordinate to be used for this plotted element. Can be numeric or string. This is generally used with 1D positional arguments.labels, values (sequence of
floator sequence ofstr, optional) – The legend labels or colorbar coordinates used for each plotted element. Can be numeric or string, and must match the number of plotted elements. This is generally used with 2D positional arguments.colorbar (
bool,int, orstr, optional) – If notNone, this is a location specifying where to draw an inset or outer colorbar from the resulting object(s). IfTrue, the defaultrc['colorbar.loc']='right'is used. If the same location is used in successive plotting calls, object(s) will be added to the existing colorbar in that location (valid for colorbars built from lists of artists). Valid locations are shown in incolorbar.colorbar_kw (dict-like, optional) – Extra keyword args for the call to
colorbar.legend (
bool,int, orstr, optional) – Location specifying where to draw an inset or outer legend from the resulting object(s). IfTrue, the defaultrc['legend.loc']='best'is used. If the same location is used in successive plotting calls, object(s) will be added to existing legend in that location. Valid locations are shown inlegend().legend_kw (dict-like, optional) – Extra keyword args for the call to
legend.**kwargs – Passed to
step.
See also
- stepx(*args, **kwargs)[source]
Plot step lines.
- Parameters:
*args (
xory,x) – The data passed as positional or keyword arguments. Interpreted as follows:If only
xcoordinates are passed, try to infer theycoordinates from theSeriesorDataFrameindices or theDataArraycoordinates. Otherwise, theycoordinates arenp.arange(0, x.shape[0]).If the
xcoordinates are a 2D array, plot each column of data in succession (except where each column of data represents a statistical distribution, as withboxplot,violinplot, or when usingmeans=Trueormedians=True).If any arguments are
pint.Quantity, auto-add the pint unit registry to matplotlib’s unit registry usingsetup_matplotlib. Apint.Quantityembedded in anxarray.DataArrayis also supported.
data (dict-like, optional) – A dict-like dataset container (e.g.,
DataFrameorDataset). If passed, each data argument can optionally be a stringkeyand the arrays used for plotting are retrieved withdata[key]. This is a native matplotlib feature.autoformat (
bool, default:rc.autoformat=True) – Whether thexaxis labels,yaxis labels, axis formatters, axes titles, legend titles, and colorbar labels are automatically configured when aSeries,DataFrame,DataArray, orQuantityis passed to the plotting command. Formatting ofpint.Quantityunit strings is controlled byrc.unitformat='L'.
- Other Parameters:
cycle (
cycle-spec, optional) – The cycle specifer, passed to theCycleconstructor. If the returned cycler is unchanged from the current cycler, the axes cycler will not be reset to its first position. To disable property cycling and just use black for the default color, usecycle=False,cycle='none', orcycle=()(analogous to disabling ticks with e.g.xformatter='none'). To restore the default property cycler, usecycle=True.lw, linewidth, linewidths (
unit-spec, default:rc['lines.linewidth']=1.5) – The width of the line(s). If float, units are points. If string, interpreted byunits.ls, linestyle, linestyles (
str, default:rc['lines.linestyle']='-') – The style of the line(s).c, color, colors (
color-spec, optional) – The color of the line(s). The propertycycleis used by default.a, alpha, alphas (
float, optional) – The opacity of the line(s). Inferred fromcolorby default.inbounds (
bool, default:rc['axes.inbounds']=True) – Whether to restrict the defaulty(x) axis limits to account for only in-bounds data when thex(y) axis limits have been locked. See alsorc['axes.inbounds']andrc['cmap.inbounds'].label, value (
floatorstr, optional) – The single legend label or colorbar coordinate to be used for this plotted element. Can be numeric or string. This is generally used with 1D positional arguments.labels, values (sequence of
floator sequence ofstr, optional) – The legend labels or colorbar coordinates used for each plotted element. Can be numeric or string, and must match the number of plotted elements. This is generally used with 2D positional arguments.colorbar (
bool,int, orstr, optional) – If notNone, this is a location specifying where to draw an inset or outer colorbar from the resulting object(s). IfTrue, the defaultrc['colorbar.loc']='right'is used. If the same location is used in successive plotting calls, object(s) will be added to the existing colorbar in that location (valid for colorbars built from lists of artists). Valid locations are shown in incolorbar.colorbar_kw (dict-like, optional) – Extra keyword args for the call to
colorbar.legend (
bool,int, orstr, optional) – Location specifying where to draw an inset or outer legend from the resulting object(s). IfTrue, the defaultrc['legend.loc']='best'is used. If the same location is used in successive plotting calls, object(s) will be added to existing legend in that location. Valid locations are shown inlegend().legend_kw (dict-like, optional) – Extra keyword args for the call to
legend.**kwargs – Passed to
step.
See also
- stream(*args, **kwargs)[source]
Plot streamlines.
- Parameters:
*args (
u,vorx,y,u,v) – The data passed as positional or keyword arguments. Interpreted as follows:If only
uandvcoordinates are passed, try to infer thexandycoordinates from theDataFrameindices and columns or theDataArraycoordinates. Otherwise, theycoordinates arenp.arange(0, y.shape[0])and thexcoordinates arenp.arange(0, y.shape[1]).For
pcolorandpcolormesh, calculate coordinate edges usingedgesor:func:`~ultraplot.utils.edges2d`if centers were provided. For all other methods, calculate coordinate centers if edges were provided.If the
xorycoordinates arepint.Quantity, auto-add the pint unit registry to matplotlib’s unit registry usingsetup_matplotlib. If theuandvcoordinates arepint.Quantity, pass the magnitude to the plotting command. Apint.Quantityembedded in anxarray.DataArrayis also supported.
c, color, colors (array-like or
color-spec, optional) – The colors of the streamlines passed as either a keyword argument or a fifth positional argument. This can be a single color or a color array to be scaled bycmapandnorm.data (dict-like, optional) – A dict-like dataset container (e.g.,
DataFrameorDataset). If passed, each data argument can optionally be a stringkeyand the arrays used for plotting are retrieved withdata[key]. This is a native matplotlib feature.autoformat (
bool, default:rc.autoformat=True) – Whether thexaxis labels,yaxis labels, axis formatters, axes titles, legend titles, and colorbar labels are automatically configured when aSeries,DataFrame,DataArray, orQuantityis passed to the plotting command. Formatting ofpint.Quantityunit strings is controlled byrc.unitformat='L'.transpose (
bool, default:False) – Whether to transpose the input data. This should be used when passing datasets with column-major dimension order(x, y). Otherwise row-major dimension order(y, x)is expected.order (
{'C', 'F'}, default:'C') – Alternative totranspose.'C'corresponds to the default C-cyle row-major ordering (equivalent totranspose=False).'F'corresponds to Fortran-style column-major ordering (equivalent totranspose=True).globe (
bool, default:False) – Forultraplot.axes.GeoAxesonly. Whether to enforce global coverage. When set toTruethis does the following:Interpolates input data to the North and South poles by setting the data values at the poles to the mean from latitudes nearest each pole.
Makes meridional coverage “circular”, i.e. the last longitude coordinate equals the first longitude coordinate plus 360°.
When basemap is the backend, cycles 1D longitude vectors to fit within the map edges. For example, if the central longitude is 90°, the data is shifted so that it spans -90° to 270°.
- Other Parameters:
cmap (
colormap-spec, default:rc['cmap.sequential']='Fire'orrc['cmap.diverging']='BuRd') – The colormap specifer, passed to theColormapconstructor function. Ifrc['cmap.autodiverging']isTrueand the normalization range contains negative and positive values thenrc['cmap.diverging']is used. Otherwiserc['cmap.sequential']is used.c, color, colors (
color-specor sequence ofcolor-spec, optional) – The color(s) used to create aDiscreteColormap. If not passed,cmapis used.norm (
norm-spec, default:NormalizeorDivergingNorm) – The data value normalizer, passed to theNormconstructor function. IfdiscreteisTruethen 1) this affects the default level-generation algorithm (e.g.norm='log'builds levels in log-space) and 2) this is passed toDiscreteNormto scale the colors before they are discretized (ifnormis not already aDiscreteNorm). Ifrc['cmap.autodiverging']isTrueand the normalization range contains negative and positive values thenDivergingNormis used. OtherwiseNormalizeis used.extend (
{'neither', 'both', 'min', 'max'}, default:'neither') – Direction for drawing colorbar “extensions” indicating out-of-bounds data on the end of the colorbar.discrete (
bool, default:rc['cmap.discrete']=None) – IfFalse, thenDiscreteNormis not applied to the colormap. Instead, for non-contour plots, the number of levels will be roughly controlled byrc['cmap.lut']. This has a similar effect to usinglevels=large_numberbut it may improve rendering speed. Default isTrueonly for contouring commands likecontourfand pseudocolor commands likepcolor.sequential, diverging, cyclic, qualitative (
bool, default:None) – Boolean arguments used ifcmapis not passed. Set these toTrueto use the defaultrc['cmap.sequential'],rc['cmap.diverging'],rc['cmap.cyclic'], andrc['cmap.qualitative']colormaps. Thedivergingoption also appliesDivergingNormas the default continuous normalizer.vmin, vmax (
float, optional) – The minimum and maximum color scale values used with thenormnormalizer. IfdiscreteisFalsethese are the absolute limits, and ifdiscreteisTruethese are the approximate limits used to automatically determinelevelsorvalueslists at “nice” intervals. Iflevelsorvalueswere already passed as lists, these are ignored, andvminandvmaxare set to the minimum and maximum of the lists. Ifrobustwas passed, the defaultvminandvmaxare some percentile range of the data values. Otherwise, the defaultvminandvmaxare the minimum and maximum of the data values.N – Shorthand for
levels.levels (
intor sequence offloat, default:rc['cmap.levels']=11) – The number of level edges or a sequence of level edges. If the former,locatoris used to generate this many level edges at “nice” intervals. If the latter, the levels should be monotonically increasing or decreasing (note decreasing levels fail withcontourplots).values (
intor sequence offloat, default:None) – The number of level centers or a sequence of level centers. If the former,locatoris used to generate this many level centers at “nice” intervals. If the latter, levels are inferred usingedges. This will override anylevelsinput.center_levels (
bool, defaultFalse) – If set to true, the discrete color bar bins will be centered on the level values instead of using the level values as the edges of the discrete bins. This option can be used for diverging, discrete color bars with both positive and negative data to ensure data near zero is properly represented.robust (
bool,float, or2-tuple, default:rc['cmap.robust']=False) – IfTrueandvminorvmaxwere not provided, they are determined from the 2nd and 98th data percentiles rather than the minimum and maximum. If float, this percentile range is used (for example,90corresponds to the 5th to 95th percentiles). If 2-tuple of float, these specific percentiles should be used. This feature is useful when your data has large outliers.inbounds (
bool, default:rc['cmap.inbounds']=True) – IfTrueandvminorvmaxwere not provided, when axis limits have been explicitly restricted withset_xlim()orset_ylim(), out-of-bounds data is ignored. See alsorc['cmap.inbounds']andrc['axes.inbounds'].locator (
locator-spec, default:matplotlib.ticker.MaxNLocator) – The locator used to determine level locations iflevelsorvalueswere not already passed as lists. Passed to theLocatorconstructor. Default isMaxNLocatorwithlevelsinteger levels.locator_kw (dict-like, optional) – Keyword arguments passed to
matplotlib.ticker.Locatorclass.symmetric (
bool, default:False) – IfTrue, the normalization range or discrete colormap levels are symmetric about zero.positive (
bool, default:False) – IfTrue, the normalization range or discrete colormap levels are positive with a minimum at zero.negative (
bool, default:False) – IfTrue, the normaliation range or discrete colormap levels are negative with a minimum at zero.nozero (
bool, default:False) – IfTrue,0is removed from the level list. This is mainly useful for single-colorcontourplots.**kwargs – Passed to
matplotlib.axes.Axes.streamplot
- streamplot(**kwargs)[source]
Plot streamlines.
- Parameters:
*args (
u,vorx,y,u,v) – The data passed as positional or keyword arguments. Interpreted as follows:If only
uandvcoordinates are passed, try to infer thexandycoordinates from theDataFrameindices and columns or theDataArraycoordinates. Otherwise, theycoordinates arenp.arange(0, y.shape[0])and thexcoordinates arenp.arange(0, y.shape[1]).For
pcolorandpcolormesh, calculate coordinate edges usingedgesor:func:`~ultraplot.utils.edges2d`if centers were provided. For all other methods, calculate coordinate centers if edges were provided.If the
xorycoordinates arepint.Quantity, auto-add the pint unit registry to matplotlib’s unit registry usingsetup_matplotlib. If theuandvcoordinates arepint.Quantity, pass the magnitude to the plotting command. Apint.Quantityembedded in anxarray.DataArrayis also supported.
c, color, colors (array-like or
color-spec, optional) – The colors of the streamlines passed as either a keyword argument or a fifth positional argument. This can be a single color or a color array to be scaled bycmapandnorm.data (dict-like, optional) – A dict-like dataset container (e.g.,
DataFrameorDataset). If passed, each data argument can optionally be a stringkeyand the arrays used for plotting are retrieved withdata[key]. This is a native matplotlib feature.autoformat (
bool, default:rc.autoformat=True) – Whether thexaxis labels,yaxis labels, axis formatters, axes titles, legend titles, and colorbar labels are automatically configured when aSeries,DataFrame,DataArray, orQuantityis passed to the plotting command. Formatting ofpint.Quantityunit strings is controlled byrc.unitformat='L'.transpose (
bool, default:False) – Whether to transpose the input data. This should be used when passing datasets with column-major dimension order(x, y). Otherwise row-major dimension order(y, x)is expected.order (
{'C', 'F'}, default:'C') – Alternative totranspose.'C'corresponds to the default C-cyle row-major ordering (equivalent totranspose=False).'F'corresponds to Fortran-style column-major ordering (equivalent totranspose=True).globe (
bool, default:False) – Forultraplot.axes.GeoAxesonly. Whether to enforce global coverage. When set toTruethis does the following:Interpolates input data to the North and South poles by setting the data values at the poles to the mean from latitudes nearest each pole.
Makes meridional coverage “circular”, i.e. the last longitude coordinate equals the first longitude coordinate plus 360°.
When basemap is the backend, cycles 1D longitude vectors to fit within the map edges. For example, if the central longitude is 90°, the data is shifted so that it spans -90° to 270°.
- Other Parameters:
cmap (
colormap-spec, default:rc['cmap.sequential']='Fire'orrc['cmap.diverging']='BuRd') – The colormap specifer, passed to theColormapconstructor function. Ifrc['cmap.autodiverging']isTrueand the normalization range contains negative and positive values thenrc['cmap.diverging']is used. Otherwiserc['cmap.sequential']is used.c, color, colors (
color-specor sequence ofcolor-spec, optional) – The color(s) used to create aDiscreteColormap. If not passed,cmapis used.norm (
norm-spec, default:NormalizeorDivergingNorm) – The data value normalizer, passed to theNormconstructor function. IfdiscreteisTruethen 1) this affects the default level-generation algorithm (e.g.norm='log'builds levels in log-space) and 2) this is passed toDiscreteNormto scale the colors before they are discretized (ifnormis not already aDiscreteNorm). Ifrc['cmap.autodiverging']isTrueand the normalization range contains negative and positive values thenDivergingNormis used. OtherwiseNormalizeis used.extend (
{'neither', 'both', 'min', 'max'}, default:'neither') – Direction for drawing colorbar “extensions” indicating out-of-bounds data on the end of the colorbar.discrete (
bool, default:rc['cmap.discrete']=None) – IfFalse, thenDiscreteNormis not applied to the colormap. Instead, for non-contour plots, the number of levels will be roughly controlled byrc['cmap.lut']. This has a similar effect to usinglevels=large_numberbut it may improve rendering speed. Default isTrueonly for contouring commands likecontourfand pseudocolor commands likepcolor.sequential, diverging, cyclic, qualitative (
bool, default:None) – Boolean arguments used ifcmapis not passed. Set these toTrueto use the defaultrc['cmap.sequential'],rc['cmap.diverging'],rc['cmap.cyclic'], andrc['cmap.qualitative']colormaps. Thedivergingoption also appliesDivergingNormas the default continuous normalizer.vmin, vmax (
float, optional) – The minimum and maximum color scale values used with thenormnormalizer. IfdiscreteisFalsethese are the absolute limits, and ifdiscreteisTruethese are the approximate limits used to automatically determinelevelsorvalueslists at “nice” intervals. Iflevelsorvalueswere already passed as lists, these are ignored, andvminandvmaxare set to the minimum and maximum of the lists. Ifrobustwas passed, the defaultvminandvmaxare some percentile range of the data values. Otherwise, the defaultvminandvmaxare the minimum and maximum of the data values.N – Shorthand for
levels.levels (
intor sequence offloat, default:rc['cmap.levels']=11) – The number of level edges or a sequence of level edges. If the former,locatoris used to generate this many level edges at “nice” intervals. If the latter, the levels should be monotonically increasing or decreasing (note decreasing levels fail withcontourplots).values (
intor sequence offloat, default:None) – The number of level centers or a sequence of level centers. If the former,locatoris used to generate this many level centers at “nice” intervals. If the latter, levels are inferred usingedges. This will override anylevelsinput.center_levels (
bool, defaultFalse) – If set to true, the discrete color bar bins will be centered on the level values instead of using the level values as the edges of the discrete bins. This option can be used for diverging, discrete color bars with both positive and negative data to ensure data near zero is properly represented.robust (
bool,float, or2-tuple, default:rc['cmap.robust']=False) – IfTrueandvminorvmaxwere not provided, they are determined from the 2nd and 98th data percentiles rather than the minimum and maximum. If float, this percentile range is used (for example,90corresponds to the 5th to 95th percentiles). If 2-tuple of float, these specific percentiles should be used. This feature is useful when your data has large outliers.inbounds (
bool, default:rc['cmap.inbounds']=True) – IfTrueandvminorvmaxwere not provided, when axis limits have been explicitly restricted withset_xlim()orset_ylim(), out-of-bounds data is ignored. See alsorc['cmap.inbounds']andrc['axes.inbounds'].locator (
locator-spec, default:matplotlib.ticker.MaxNLocator) – The locator used to determine level locations iflevelsorvalueswere not already passed as lists. Passed to theLocatorconstructor. Default isMaxNLocatorwithlevelsinteger levels.locator_kw (dict-like, optional) – Keyword arguments passed to
matplotlib.ticker.Locatorclass.symmetric (
bool, default:False) – IfTrue, the normalization range or discrete colormap levels are symmetric about zero.positive (
bool, default:False) – IfTrue, the normalization range or discrete colormap levels are positive with a minimum at zero.negative (
bool, default:False) – IfTrue, the normaliation range or discrete colormap levels are negative with a minimum at zero.nozero (
bool, default:False) – IfTrue,0is removed from the level list. This is mainly useful for single-colorcontourplots.**kwargs – Passed to
matplotlib.axes.Axes.streamplot
- tricontour(**kwargs)[source]
Plot contour lines on a triangular grid.
- Parameters:
*args (
zorx,y,z) – The data passed as positional or keyword arguments. Interpreted as follows:If only
zcoordinates are passed, try to infer thexandycoordinates from theDataFrameindices and columns or theDataArraycoordinates. Otherwise, theycoordinates arenp.arange(0, y.shape[0])and thexcoordinates arenp.arange(0, y.shape[1]).For
pcolorandpcolormesh, calculate coordinate edges usingedgesor:func:`~ultraplot.utils.edges2d`if centers were provided. For all other methods, calculate coordinate centers if edges were provided.If the
xorycoordinates arepint.Quantity, auto-add the pint unit registry to matplotlib’s unit registry usingsetup_matplotlib. If thezcoordinates arepint.Quantity, pass the magnitude to the plotting command. Apint.Quantityembedded in anxarray.DataArrayis also supported.
data (dict-like, optional) – A dict-like dataset container (e.g.,
DataFrameorDataset). If passed, each data argument can optionally be a stringkeyand the arrays used for plotting are retrieved withdata[key]. This is a native matplotlib feature.autoformat (
bool, default:rc.autoformat=True) – Whether thexaxis labels,yaxis labels, axis formatters, axes titles, legend titles, and colorbar labels are automatically configured when aSeries,DataFrame,DataArray, orQuantityis passed to the plotting command. Formatting ofpint.Quantityunit strings is controlled byrc.unitformat='L'.transpose (
bool, default:False) – Whether to transpose the input data. This should be used when passing datasets with column-major dimension order(x, y). Otherwise row-major dimension order(y, x)is expected.order (
{'C', 'F'}, default:'C') – Alternative totranspose.'C'corresponds to the default C-cyle row-major ordering (equivalent totranspose=False).'F'corresponds to Fortran-style column-major ordering (equivalent totranspose=True).globe (
bool, default:False) – Forultraplot.axes.GeoAxesonly. Whether to enforce global coverage. When set toTruethis does the following:Interpolates input data to the North and South poles by setting the data values at the poles to the mean from latitudes nearest each pole.
Makes meridional coverage “circular”, i.e. the last longitude coordinate equals the first longitude coordinate plus 360°.
When basemap is the backend, cycles 1D longitude vectors to fit within the map edges. For example, if the central longitude is 90°, the data is shifted so that it spans -90° to 270°.
- Other Parameters:
cmap (
colormap-spec, default:rc['cmap.sequential']='Fire'orrc['cmap.diverging']='BuRd') – The colormap specifer, passed to theColormapconstructor function. Ifrc['cmap.autodiverging']isTrueand the normalization range contains negative and positive values thenrc['cmap.diverging']is used. Otherwiserc['cmap.sequential']is used.c, color, colors (
color-specor sequence ofcolor-spec, optional) – The color(s) used to create aDiscreteColormap. If not passed,cmapis used.norm (
norm-spec, default:NormalizeorDivergingNorm) – The data value normalizer, passed to theNormconstructor function. IfdiscreteisTruethen 1) this affects the default level-generation algorithm (e.g.norm='log'builds levels in log-space) and 2) this is passed toDiscreteNormto scale the colors before they are discretized (ifnormis not already aDiscreteNorm). Ifrc['cmap.autodiverging']isTrueand the normalization range contains negative and positive values thenDivergingNormis used. OtherwiseNormalizeis used.extend (
{'neither', 'both', 'min', 'max'}, default:'neither') – Direction for drawing colorbar “extensions” indicating out-of-bounds data on the end of the colorbar.discrete (
bool, default:rc['cmap.discrete']=None) – IfFalse, thenDiscreteNormis not applied to the colormap. Instead, for non-contour plots, the number of levels will be roughly controlled byrc['cmap.lut']. This has a similar effect to usinglevels=large_numberbut it may improve rendering speed. Default isTrueonly for contouring commands likecontourfand pseudocolor commands likepcolor.sequential, diverging, cyclic, qualitative (
bool, default:None) – Boolean arguments used ifcmapis not passed. Set these toTrueto use the defaultrc['cmap.sequential'],rc['cmap.diverging'],rc['cmap.cyclic'], andrc['cmap.qualitative']colormaps. Thedivergingoption also appliesDivergingNormas the default continuous normalizer.vmin, vmax (
float, optional) – The minimum and maximum color scale values used with thenormnormalizer. IfdiscreteisFalsethese are the absolute limits, and ifdiscreteisTruethese are the approximate limits used to automatically determinelevelsorvalueslists at “nice” intervals. Iflevelsorvalueswere already passed as lists, these are ignored, andvminandvmaxare set to the minimum and maximum of the lists. Ifrobustwas passed, the defaultvminandvmaxare some percentile range of the data values. Otherwise, the defaultvminandvmaxare the minimum and maximum of the data values.N – Shorthand for
levels.levels (
intor sequence offloat, default:rc['cmap.levels']=11) – The number of level edges or a sequence of level edges. If the former,locatoris used to generate this many level edges at “nice” intervals. If the latter, the levels should be monotonically increasing or decreasing (note decreasing levels fail withcontourplots).values (
intor sequence offloat, default:None) – The number of level centers or a sequence of level centers. If the former,locatoris used to generate this many level centers at “nice” intervals. If the latter, levels are inferred usingedges. This will override anylevelsinput.center_levels (
bool, defaultFalse) – If set to true, the discrete color bar bins will be centered on the level values instead of using the level values as the edges of the discrete bins. This option can be used for diverging, discrete color bars with both positive and negative data to ensure data near zero is properly represented.robust (
bool,float, or2-tuple, default:rc['cmap.robust']=False) – IfTrueandvminorvmaxwere not provided, they are determined from the 2nd and 98th data percentiles rather than the minimum and maximum. If float, this percentile range is used (for example,90corresponds to the 5th to 95th percentiles). If 2-tuple of float, these specific percentiles should be used. This feature is useful when your data has large outliers.inbounds (
bool, default:rc['cmap.inbounds']=True) – IfTrueandvminorvmaxwere not provided, when axis limits have been explicitly restricted withset_xlim()orset_ylim(), out-of-bounds data is ignored. See alsorc['cmap.inbounds']andrc['axes.inbounds'].locator (
locator-spec, default:matplotlib.ticker.MaxNLocator) – The locator used to determine level locations iflevelsorvalueswere not already passed as lists. Passed to theLocatorconstructor. Default isMaxNLocatorwithlevelsinteger levels.locator_kw (dict-like, optional) – Keyword arguments passed to
matplotlib.ticker.Locatorclass.symmetric (
bool, default:False) – IfTrue, the normalization range or discrete colormap levels are symmetric about zero.positive (
bool, default:False) – IfTrue, the normalization range or discrete colormap levels are positive with a minimum at zero.negative (
bool, default:False) – IfTrue, the normaliation range or discrete colormap levels are negative with a minimum at zero.nozero (
bool, default:False) – IfTrue,0is removed from the level list. This is mainly useful for single-colorcontourplots.lw, linewidth, linewidths (
unit-spec, default:0.3orrc['lines.linewidth']=1.5) – The width of the line contours. Default is0.3when adding to filled contours orrc['lines.linewidth']=1.5otherwise. If float, units are points. If string, interpreted byunits.ls, linestyle, linestyles (
str, default:'-'orrc['contour.negative_linestyle']='dashed') – The style of the line contours. Default is'-'for positive contours andrc['contour.negative_linestyle']for negative contours.ec, edgecolor, edgecolors (
color-spec, default:'k'orinferred) – The color of the line contours. Default is'k'when adding to filled contours or inferred fromcolororcmapotherwise.a, alpha, alpha (
float, optional) – The opacity of the contours. Inferred fromedgecolorby default.label (
str, optional) – The legend label to be used for this object. In the case of contours, this is paired with the the central artist in the artist list returned bymatplotlib.contour.ContourSet.legend_elements.labels (
bool, optional) – Whether to apply labels to contours and grid boxes. The text will be white when the luminance of the underlying filled contour or grid box is less than 50 and black otherwise.labels_kw (dict-like, optional) – Ignored if
labelsisFalse. Extra keyword args for the labels. For contour plots, this is passed toclabel. Otherwise, this is passed totext.formatter, fmt (
formatter-spec, optional) – TheFormatterused to format number labels. Passed to theFormatterconstructor.formatter_kw (dict-like, optional) – Keyword arguments passed to
matplotlib.ticker.Formatterclass.precision (
int, optional) – The maximum number of decimal places for number labels generated with the default formatterSimpleformatter.colorbar (
bool,int, orstr, optional) – If notNone, this is a location specifying where to draw an inset or outer colorbar from the resulting object(s). IfTrue, the defaultrc['colorbar.loc']='right'is used. If the same location is used in successive plotting calls, object(s) will be added to the existing colorbar in that location (valid for colorbars built from lists of artists). Valid locations are shown in incolorbar.colorbar_kw (dict-like, optional) – Extra keyword args for the call to
colorbar.legend (
bool,int, orstr, optional) – Location specifying where to draw an inset or outer legend from the resulting object(s). IfTrue, the defaultrc['legend.loc']='best'is used. If the same location is used in successive plotting calls, object(s) will be added to existing legend in that location. Valid locations are shown inlegend().legend_kw (dict-like, optional) – Extra keyword args for the call to
legend.**kwargs – Passed to
matplotlib.axes.Axes.tricontour.
- tricontourf(**kwargs)[source]
Plot filled contours on a triangular grid.
- Parameters:
*args (
zorx,y,z) – The data passed as positional or keyword arguments. Interpreted as follows:If only
zcoordinates are passed, try to infer thexandycoordinates from theDataFrameindices and columns or theDataArraycoordinates. Otherwise, theycoordinates arenp.arange(0, y.shape[0])and thexcoordinates arenp.arange(0, y.shape[1]).For
pcolorandpcolormesh, calculate coordinate edges usingedgesor:func:`~ultraplot.utils.edges2d`if centers were provided. For all other methods, calculate coordinate centers if edges were provided.If the
xorycoordinates arepint.Quantity, auto-add the pint unit registry to matplotlib’s unit registry usingsetup_matplotlib. If thezcoordinates arepint.Quantity, pass the magnitude to the plotting command. Apint.Quantityembedded in anxarray.DataArrayis also supported.
data (dict-like, optional) – A dict-like dataset container (e.g.,
DataFrameorDataset). If passed, each data argument can optionally be a stringkeyand the arrays used for plotting are retrieved withdata[key]. This is a native matplotlib feature.autoformat (
bool, default:rc.autoformat=True) – Whether thexaxis labels,yaxis labels, axis formatters, axes titles, legend titles, and colorbar labels are automatically configured when aSeries,DataFrame,DataArray, orQuantityis passed to the plotting command. Formatting ofpint.Quantityunit strings is controlled byrc.unitformat='L'.transpose (
bool, default:False) – Whether to transpose the input data. This should be used when passing datasets with column-major dimension order(x, y). Otherwise row-major dimension order(y, x)is expected.order (
{'C', 'F'}, default:'C') – Alternative totranspose.'C'corresponds to the default C-cyle row-major ordering (equivalent totranspose=False).'F'corresponds to Fortran-style column-major ordering (equivalent totranspose=True).globe (
bool, default:False) – Forultraplot.axes.GeoAxesonly. Whether to enforce global coverage. When set toTruethis does the following:Interpolates input data to the North and South poles by setting the data values at the poles to the mean from latitudes nearest each pole.
Makes meridional coverage “circular”, i.e. the last longitude coordinate equals the first longitude coordinate plus 360°.
When basemap is the backend, cycles 1D longitude vectors to fit within the map edges. For example, if the central longitude is 90°, the data is shifted so that it spans -90° to 270°.
- Other Parameters:
cmap (
colormap-spec, default:rc['cmap.sequential']='Fire'orrc['cmap.diverging']='BuRd') – The colormap specifer, passed to theColormapconstructor function. Ifrc['cmap.autodiverging']isTrueand the normalization range contains negative and positive values thenrc['cmap.diverging']is used. Otherwiserc['cmap.sequential']is used.c, color, colors (
color-specor sequence ofcolor-spec, optional) – The color(s) used to create aDiscreteColormap. If not passed,cmapis used.norm (
norm-spec, default:NormalizeorDivergingNorm) – The data value normalizer, passed to theNormconstructor function. IfdiscreteisTruethen 1) this affects the default level-generation algorithm (e.g.norm='log'builds levels in log-space) and 2) this is passed toDiscreteNormto scale the colors before they are discretized (ifnormis not already aDiscreteNorm). Ifrc['cmap.autodiverging']isTrueand the normalization range contains negative and positive values thenDivergingNormis used. OtherwiseNormalizeis used.extend (
{'neither', 'both', 'min', 'max'}, default:'neither') – Direction for drawing colorbar “extensions” indicating out-of-bounds data on the end of the colorbar.discrete (
bool, default:rc['cmap.discrete']=None) – IfFalse, thenDiscreteNormis not applied to the colormap. Instead, for non-contour plots, the number of levels will be roughly controlled byrc['cmap.lut']. This has a similar effect to usinglevels=large_numberbut it may improve rendering speed. Default isTrueonly for contouring commands likecontourfand pseudocolor commands likepcolor.sequential, diverging, cyclic, qualitative (
bool, default:None) – Boolean arguments used ifcmapis not passed. Set these toTrueto use the defaultrc['cmap.sequential'],rc['cmap.diverging'],rc['cmap.cyclic'], andrc['cmap.qualitative']colormaps. Thedivergingoption also appliesDivergingNormas the default continuous normalizer.vmin, vmax (
float, optional) – The minimum and maximum color scale values used with thenormnormalizer. IfdiscreteisFalsethese are the absolute limits, and ifdiscreteisTruethese are the approximate limits used to automatically determinelevelsorvalueslists at “nice” intervals. Iflevelsorvalueswere already passed as lists, these are ignored, andvminandvmaxare set to the minimum and maximum of the lists. Ifrobustwas passed, the defaultvminandvmaxare some percentile range of the data values. Otherwise, the defaultvminandvmaxare the minimum and maximum of the data values.N – Shorthand for
levels.levels (
intor sequence offloat, default:rc['cmap.levels']=11) – The number of level edges or a sequence of level edges. If the former,locatoris used to generate this many level edges at “nice” intervals. If the latter, the levels should be monotonically increasing or decreasing (note decreasing levels fail withcontourplots).values (
intor sequence offloat, default:None) – The number of level centers or a sequence of level centers. If the former,locatoris used to generate this many level centers at “nice” intervals. If the latter, levels are inferred usingedges. This will override anylevelsinput.center_levels (
bool, defaultFalse) – If set to true, the discrete color bar bins will be centered on the level values instead of using the level values as the edges of the discrete bins. This option can be used for diverging, discrete color bars with both positive and negative data to ensure data near zero is properly represented.robust (
bool,float, or2-tuple, default:rc['cmap.robust']=False) – IfTrueandvminorvmaxwere not provided, they are determined from the 2nd and 98th data percentiles rather than the minimum and maximum. If float, this percentile range is used (for example,90corresponds to the 5th to 95th percentiles). If 2-tuple of float, these specific percentiles should be used. This feature is useful when your data has large outliers.inbounds (
bool, default:rc['cmap.inbounds']=True) – IfTrueandvminorvmaxwere not provided, when axis limits have been explicitly restricted withset_xlim()orset_ylim(), out-of-bounds data is ignored. See alsorc['cmap.inbounds']andrc['axes.inbounds'].locator (
locator-spec, default:matplotlib.ticker.MaxNLocator) – The locator used to determine level locations iflevelsorvalueswere not already passed as lists. Passed to theLocatorconstructor. Default isMaxNLocatorwithlevelsinteger levels.locator_kw (dict-like, optional) – Keyword arguments passed to
matplotlib.ticker.Locatorclass.symmetric (
bool, default:False) – IfTrue, the normalization range or discrete colormap levels are symmetric about zero.positive (
bool, default:False) – IfTrue, the normalization range or discrete colormap levels are positive with a minimum at zero.negative (
bool, default:False) – IfTrue, the normaliation range or discrete colormap levels are negative with a minimum at zero.nozero (
bool, default:False) – IfTrue,0is removed from the level list. This is mainly useful for single-colorcontourplots.lw, linewidth, linewidths (
unit-spec, default:0.3orrc['lines.linewidth']=1.5) – The width of the line contours. Default is0.3when adding to filled contours orrc['lines.linewidth']=1.5otherwise. If float, units are points. If string, interpreted byunits.ls, linestyle, linestyles (
str, default:'-'orrc['contour.negative_linestyle']='dashed') – The style of the line contours. Default is'-'for positive contours andrc['contour.negative_linestyle']for negative contours.ec, edgecolor, edgecolors (
color-spec, default:'k'orinferred) – The color of the line contours. Default is'k'when adding to filled contours or inferred fromcolororcmapotherwise.a, alpha, alpha (
float, optional) – The opacity of the contours. Inferred fromedgecolorby default.edgefix (
boolorfloat, default:rc.edgefix=True) – Whether to fix the common issue where white lines appear between adjacent patches in saved vector graphics (this can slow down figure rendering). See this github repo for a demonstration of the problem. IfTrue, a small default linewidth of0.3is used to cover up the white lines. If float (e.g.edgefix=0.5), this specific linewidth is used to cover up the white lines. This feature is automatically disabled when the patches have transparency.label (
str, optional) – The legend label to be used for this object. In the case of contours, this is paired with the the central artist in the artist list returned bymatplotlib.contour.ContourSet.legend_elements.labels (
bool, optional) – Whether to apply labels to contours and grid boxes. The text will be white when the luminance of the underlying filled contour or grid box is less than 50 and black otherwise.labels_kw (dict-like, optional) – Ignored if
labelsisFalse. Extra keyword args for the labels. For contour plots, this is passed toclabel. Otherwise, this is passed totext.formatter, fmt (
formatter-spec, optional) – TheFormatterused to format number labels. Passed to theFormatterconstructor.formatter_kw (dict-like, optional) – Keyword arguments passed to
matplotlib.ticker.Formatterclass.precision (
int, optional) – The maximum number of decimal places for number labels generated with the default formatterSimpleformatter.colorbar (
bool,int, orstr, optional) – If notNone, this is a location specifying where to draw an inset or outer colorbar from the resulting object(s). IfTrue, the defaultrc['colorbar.loc']='right'is used. If the same location is used in successive plotting calls, object(s) will be added to the existing colorbar in that location (valid for colorbars built from lists of artists). Valid locations are shown in incolorbar.colorbar_kw (dict-like, optional) – Extra keyword args for the call to
colorbar.legend (
bool,int, orstr, optional) – Location specifying where to draw an inset or outer legend from the resulting object(s). IfTrue, the defaultrc['legend.loc']='best'is used. If the same location is used in successive plotting calls, object(s) will be added to existing legend in that location. Valid locations are shown inlegend().legend_kw (dict-like, optional) – Extra keyword args for the call to
legend.**kwargs – Passed to
matplotlib.axes.Axes.tricontourf.
- tripcolor(**kwargs)[source]
Plot triangular grid boxes.
- Parameters:
*args (
zorx,y,z) – The data passed as positional or keyword arguments. Interpreted as follows:If only
zcoordinates are passed, try to infer thexandycoordinates from theDataFrameindices and columns or theDataArraycoordinates. Otherwise, theycoordinates arenp.arange(0, y.shape[0])and thexcoordinates arenp.arange(0, y.shape[1]).For
pcolorandpcolormesh, calculate coordinate edges usingedgesor:func:`~ultraplot.utils.edges2d`if centers were provided. For all other methods, calculate coordinate centers if edges were provided.If the
xorycoordinates arepint.Quantity, auto-add the pint unit registry to matplotlib’s unit registry usingsetup_matplotlib. If thezcoordinates arepint.Quantity, pass the magnitude to the plotting command. Apint.Quantityembedded in anxarray.DataArrayis also supported.
data (dict-like, optional) – A dict-like dataset container (e.g.,
DataFrameorDataset). If passed, each data argument can optionally be a stringkeyand the arrays used for plotting are retrieved withdata[key]. This is a native matplotlib feature.autoformat (
bool, default:rc.autoformat=True) – Whether thexaxis labels,yaxis labels, axis formatters, axes titles, legend titles, and colorbar labels are automatically configured when aSeries,DataFrame,DataArray, orQuantityis passed to the plotting command. Formatting ofpint.Quantityunit strings is controlled byrc.unitformat='L'.transpose (
bool, default:False) – Whether to transpose the input data. This should be used when passing datasets with column-major dimension order(x, y). Otherwise row-major dimension order(y, x)is expected.order (
{'C', 'F'}, default:'C') – Alternative totranspose.'C'corresponds to the default C-cyle row-major ordering (equivalent totranspose=False).'F'corresponds to Fortran-style column-major ordering (equivalent totranspose=True).globe (
bool, default:False) – Forultraplot.axes.GeoAxesonly. Whether to enforce global coverage. When set toTruethis does the following:Interpolates input data to the North and South poles by setting the data values at the poles to the mean from latitudes nearest each pole.
Makes meridional coverage “circular”, i.e. the last longitude coordinate equals the first longitude coordinate plus 360°.
When basemap is the backend, cycles 1D longitude vectors to fit within the map edges. For example, if the central longitude is 90°, the data is shifted so that it spans -90° to 270°.
- Other Parameters:
cmap (
colormap-spec, default:rc['cmap.sequential']='Fire'orrc['cmap.diverging']='BuRd') – The colormap specifer, passed to theColormapconstructor function. Ifrc['cmap.autodiverging']isTrueand the normalization range contains negative and positive values thenrc['cmap.diverging']is used. Otherwiserc['cmap.sequential']is used.c, color, colors (
color-specor sequence ofcolor-spec, optional) – The color(s) used to create aDiscreteColormap. If not passed,cmapis used.norm (
norm-spec, default:NormalizeorDivergingNorm) – The data value normalizer, passed to theNormconstructor function. IfdiscreteisTruethen 1) this affects the default level-generation algorithm (e.g.norm='log'builds levels in log-space) and 2) this is passed toDiscreteNormto scale the colors before they are discretized (ifnormis not already aDiscreteNorm). Ifrc['cmap.autodiverging']isTrueand the normalization range contains negative and positive values thenDivergingNormis used. OtherwiseNormalizeis used.extend (
{'neither', 'both', 'min', 'max'}, default:'neither') – Direction for drawing colorbar “extensions” indicating out-of-bounds data on the end of the colorbar.discrete (
bool, default:rc['cmap.discrete']=None) – IfFalse, thenDiscreteNormis not applied to the colormap. Instead, for non-contour plots, the number of levels will be roughly controlled byrc['cmap.lut']. This has a similar effect to usinglevels=large_numberbut it may improve rendering speed. Default isTrueonly for contouring commands likecontourfand pseudocolor commands likepcolor.sequential, diverging, cyclic, qualitative (
bool, default:None) – Boolean arguments used ifcmapis not passed. Set these toTrueto use the defaultrc['cmap.sequential'],rc['cmap.diverging'],rc['cmap.cyclic'], andrc['cmap.qualitative']colormaps. Thedivergingoption also appliesDivergingNormas the default continuous normalizer.vmin, vmax (
float, optional) – The minimum and maximum color scale values used with thenormnormalizer. IfdiscreteisFalsethese are the absolute limits, and ifdiscreteisTruethese are the approximate limits used to automatically determinelevelsorvalueslists at “nice” intervals. Iflevelsorvalueswere already passed as lists, these are ignored, andvminandvmaxare set to the minimum and maximum of the lists. Ifrobustwas passed, the defaultvminandvmaxare some percentile range of the data values. Otherwise, the defaultvminandvmaxare the minimum and maximum of the data values.N – Shorthand for
levels.levels (
intor sequence offloat, default:rc['cmap.levels']=11) – The number of level edges or a sequence of level edges. If the former,locatoris used to generate this many level edges at “nice” intervals. If the latter, the levels should be monotonically increasing or decreasing (note decreasing levels fail withcontourplots).values (
intor sequence offloat, default:None) – The number of level centers or a sequence of level centers. If the former,locatoris used to generate this many level centers at “nice” intervals. If the latter, levels are inferred usingedges. This will override anylevelsinput.center_levels (
bool, defaultFalse) – If set to true, the discrete color bar bins will be centered on the level values instead of using the level values as the edges of the discrete bins. This option can be used for diverging, discrete color bars with both positive and negative data to ensure data near zero is properly represented.robust (
bool,float, or2-tuple, default:rc['cmap.robust']=False) – IfTrueandvminorvmaxwere not provided, they are determined from the 2nd and 98th data percentiles rather than the minimum and maximum. If float, this percentile range is used (for example,90corresponds to the 5th to 95th percentiles). If 2-tuple of float, these specific percentiles should be used. This feature is useful when your data has large outliers.inbounds (
bool, default:rc['cmap.inbounds']=True) – IfTrueandvminorvmaxwere not provided, when axis limits have been explicitly restricted withset_xlim()orset_ylim(), out-of-bounds data is ignored. See alsorc['cmap.inbounds']andrc['axes.inbounds'].locator (
locator-spec, default:matplotlib.ticker.MaxNLocator) – The locator used to determine level locations iflevelsorvalueswere not already passed as lists. Passed to theLocatorconstructor. Default isMaxNLocatorwithlevelsinteger levels.locator_kw (dict-like, optional) – Keyword arguments passed to
matplotlib.ticker.Locatorclass.symmetric (
bool, default:False) – IfTrue, the normalization range or discrete colormap levels are symmetric about zero.positive (
bool, default:False) – IfTrue, the normalization range or discrete colormap levels are positive with a minimum at zero.negative (
bool, default:False) – IfTrue, the normaliation range or discrete colormap levels are negative with a minimum at zero.nozero (
bool, default:False) – IfTrue,0is removed from the level list. This is mainly useful for single-colorcontourplots.lw, linewidth, linewidths (
unit-spec, default:0.3) – The width of lines between grid boxes. If float, units are points. If string, interpreted byunits.ls, linestyle, linestyles (
str, default:'-') – The style of lines between grid boxes.ec, edgecolor, edgecolors (
color-spec, default:'k') – The color of lines between grid boxes.a, alpha, alphas (
float, optional) – The opacity of the grid boxes. Inferred fromcmapby default.edgefix (
boolorfloat, default:rc.edgefix=True) – Whether to fix the common issue where white lines appear between adjacent patches in saved vector graphics (this can slow down figure rendering). See this github repo for a demonstration of the problem. IfTrue, a small default linewidth of0.3is used to cover up the white lines. If float (e.g.edgefix=0.5), this specific linewidth is used to cover up the white lines. This feature is automatically disabled when the patches have transparency.label (
str, optional) – The legend label to be used for this object. In the case of contours, this is paired with the the central artist in the artist list returned bymatplotlib.contour.ContourSet.legend_elements.labels (
bool, optional) – Whether to apply labels to contours and grid boxes. The text will be white when the luminance of the underlying filled contour or grid box is less than 50 and black otherwise.labels_kw (dict-like, optional) – Ignored if
labelsisFalse. Extra keyword args for the labels. For contour plots, this is passed toclabel. Otherwise, this is passed totext.formatter, fmt (
formatter-spec, optional) – TheFormatterused to format number labels. Passed to theFormatterconstructor.formatter_kw (dict-like, optional) – Keyword arguments passed to
matplotlib.ticker.Formatterclass.precision (
int, optional) – The maximum number of decimal places for number labels generated with the default formatterSimpleformatter.colorbar (
bool,int, orstr, optional) – If notNone, this is a location specifying where to draw an inset or outer colorbar from the resulting object(s). IfTrue, the defaultrc['colorbar.loc']='right'is used. If the same location is used in successive plotting calls, object(s) will be added to the existing colorbar in that location (valid for colorbars built from lists of artists). Valid locations are shown in incolorbar.colorbar_kw (dict-like, optional) – Extra keyword args for the call to
colorbar.legend (
bool,int, orstr, optional) – Location specifying where to draw an inset or outer legend from the resulting object(s). IfTrue, the defaultrc['legend.loc']='best'is used. If the same location is used in successive plotting calls, object(s) will be added to existing legend in that location. Valid locations are shown inlegend().legend_kw (dict-like, optional) – Extra keyword args for the call to
legend.**kwargs – Passed to
matplotlib.axes.Axes.tripcolor.
- violin(*args, **kwargs)[source]
Plot vertical violins with a nice default style matching this matplotlib example.
- Parameters:
*args (
yorx,y) – The data passed as positional or keyword arguments. Interpreted as follows:If only
ycoordinates are passed, try to infer thexcoordinates from theSeriesorDataFrameindices or theDataArraycoordinates. Otherwise, thexcoordinates arenp.arange(0, y.shape[0]).If the
ycoordinates are a 2D array, plot each column of data in succession (except where each column of data represents a statistical distribution, as withboxplot,violinplot, or when usingmeans=Trueormedians=True).If any arguments are
pint.Quantity, auto-add the pint unit registry to matplotlib’s unit registry usingsetup_matplotlib. Apint.Quantityembedded in anxarray.DataArrayis also supported.
data (dict-like, optional) – A dict-like dataset container (e.g.,
DataFrameorDataset). If passed, each data argument can optionally be a stringkeyand the arrays used for plotting are retrieved withdata[key]. This is a native matplotlib feature.autoformat (
bool, default:rc.autoformat=True) – Whether thexaxis labels,yaxis labels, axis formatters, axes titles, legend titles, and colorbar labels are automatically configured when aSeries,DataFrame,DataArray, orQuantityis passed to the plotting command. Formatting ofpint.Quantityunit strings is controlled byrc.unitformat='L'.
- Other Parameters:
cycle (
cycle-spec, optional) – The cycle specifer, passed to theCycleconstructor. If the returned cycler is unchanged from the current cycler, the axes cycler will not be reset to its first position. To disable property cycling and just use black for the default color, usecycle=False,cycle='none', orcycle=()(analogous to disabling ticks with e.g.xformatter='none'). To restore the default property cycler, usecycle=True.lw, linewidth, linewidths (
unit-spec, default:rc['patch.linewidth']=0.6) – The edge width of the patch(es). If float, units are points. If string, interpreted byunits.ls, linestyle, linestyles (
str, default:'-') – The edge style of the patch(es).ec, edgecolor, edgecolors (
color-spec, default:'black') – The edge color of the patch(es).fc, facecolor, facecolors, fillcolor, fillcolors (
color-spec, optional) – The face color of the patch(es). The propertycycleis used by default.a, alpha, alphas (
float, optional) – The opacity of the patch(es). Inferred fromfacecolorandedgecolorby default.label, value (
floatorstr, optional) – The single legend label or colorbar coordinate to be used for this plotted element. Can be numeric or string. This is generally used with 1D positional arguments.labels, values (sequence of
floator sequence ofstr, optional) – The legend labels or colorbar coordinates used for each plotted element. Can be numeric or string, and must match the number of plotted elements. This is generally used with 2D positional arguments.showmeans, showmedians (
bool, optional) – Interpreted asmeans=Trueandmedians=Truewhen passed.showextrema (
bool, optional) – Interpreted asbarpctiles=Truewhen passed (i.e. shows minima and maxima).barstd, barstds (
bool,float, or2-tupleoffloat, optional) – Valid only ifmeanormedianisTrue. Standard deviation multiples for thin error bars with optional whiskers (i.e., caps). If scalar, then +/- that multiple is used. IfTrue, the default standard deviation range of +/-3 is used.barpctile, barpctiles (
bool,float, or2-tupleoffloat, optional) – Valid only ifmeanormedianisTrue. As withbarstd, but instead using percentiles for the error bars. If scalar, that percentile range is used (e.g.,90shows the 5th to 95th percentiles). IfTrue, the default percentile range of 0 to 100 is used.bardata (array-like, optional) – Valid only if
meanandmedianareFalse. If shape is 2 x N, these are the lower and upper bounds for the thin error bars. If shape is N, these are the absolute, symmetric deviations from the central points.boxes (
bool, default:None) – Shorthand forboxstd,boxstds.boxstd, boxstds, boxpctile, boxpctiles, boxdata (optional) – As with
barstd,barpctile, andbardata, but for thicker error bars representing a smaller interval than the thin error bars. IfboxstdsisTrue, the default standard deviation range of +/-1 is used. IfboxpctilesisTrue, the default percentile range of 25 to 75 is used (i.e., the interquartile range). When “boxes” and “bars” are combined, this has the effect of drawing miniature box-and-whisker plots.capsize (
float, default:rc['errorbar.capsize']=3.0) – The cap size for thin error bars in points.barz, barzorder, boxz, boxzorder (
float, default:2.5) – The “zorder” for the thin and thick error bars.barc, barcolor, boxc, boxcolor (
color-spec, default:rc['boxplot.whiskerprops.color']='black') – Colors for the thin and thick error bars.barlw, barlinewidth, boxlw, boxlinewidth (
float, default:rc['boxplot.whiskerprops.linewidth']=1.0) – Line widths for the thin and thick error bars, in points. The default for boxes is 4 timesrc['boxplot.whiskerprops.linewidth'].boxm, boxmarker (
boolormarker-spec, default:'o') – Whether to draw a small marker in the middle of the box denoting the mean or median position. Ignored ifboxesisFalse.boxms, boxmarkersize (
size-spec, default:(2 * boxlinewidth) ** 2) – The marker size for theboxmarkermarker in points ** 2.boxmc, boxmarkercolor, boxmec, boxmarkeredgecolor (
color-spec, default:'w') – Color, face color, and edge color for theboxmarkermarker.**kwargs – Passed to
matplotlib.axes.Axes.violinplot.
- violinh(*args, **kwargs)[source]
Plot horizontal violins with a nice default style matching this matplotlib example.
- Parameters:
*args (
xory,x) – The data passed as positional or keyword arguments. Interpreted as follows:If only
xcoordinates are passed, try to infer theycoordinates from theSeriesorDataFrameindices or theDataArraycoordinates. Otherwise, theycoordinates arenp.arange(0, x.shape[0]).If the
xcoordinates are a 2D array, plot each column of data in succession (except where each column of data represents a statistical distribution, as withboxplot,violinplot, or when usingmeans=Trueormedians=True).If any arguments are
pint.Quantity, auto-add the pint unit registry to matplotlib’s unit registry usingsetup_matplotlib. Apint.Quantityembedded in anxarray.DataArrayis also supported.
data (dict-like, optional) – A dict-like dataset container (e.g.,
DataFrameorDataset). If passed, each data argument can optionally be a stringkeyand the arrays used for plotting are retrieved withdata[key]. This is a native matplotlib feature.autoformat (
bool, default:rc.autoformat=True) – Whether thexaxis labels,yaxis labels, axis formatters, axes titles, legend titles, and colorbar labels are automatically configured when aSeries,DataFrame,DataArray, orQuantityis passed to the plotting command. Formatting ofpint.Quantityunit strings is controlled byrc.unitformat='L'.
- Other Parameters:
cycle (
cycle-spec, optional) – The cycle specifer, passed to theCycleconstructor. If the returned cycler is unchanged from the current cycler, the axes cycler will not be reset to its first position. To disable property cycling and just use black for the default color, usecycle=False,cycle='none', orcycle=()(analogous to disabling ticks with e.g.xformatter='none'). To restore the default property cycler, usecycle=True.lw, linewidth, linewidths (
unit-spec, default:rc['patch.linewidth']=0.6) – The edge width of the patch(es). If float, units are points. If string, interpreted byunits.ls, linestyle, linestyles (
str, default:'-') – The edge style of the patch(es).ec, edgecolor, edgecolors (
color-spec, default:'black') – The edge color of the patch(es).fc, facecolor, facecolors, fillcolor, fillcolors (
color-spec, optional) – The face color of the patch(es). The propertycycleis used by default.a, alpha, alphas (
float, optional) – The opacity of the patch(es). Inferred fromfacecolorandedgecolorby default.label, value (
floatorstr, optional) – The single legend label or colorbar coordinate to be used for this plotted element. Can be numeric or string. This is generally used with 1D positional arguments.labels, values (sequence of
floator sequence ofstr, optional) – The legend labels or colorbar coordinates used for each plotted element. Can be numeric or string, and must match the number of plotted elements. This is generally used with 2D positional arguments.showmeans, showmedians (
bool, optional) – Interpreted asmeans=Trueandmedians=Truewhen passed.showextrema (
bool, optional) – Interpreted asbarpctiles=Truewhen passed (i.e. shows minima and maxima).barstd, barstds (
bool,float, or2-tupleoffloat, optional) – Valid only ifmeanormedianisTrue. Standard deviation multiples for thin error bars with optional whiskers (i.e., caps). If scalar, then +/- that multiple is used. IfTrue, the default standard deviation range of +/-3 is used.barpctile, barpctiles (
bool,float, or2-tupleoffloat, optional) – Valid only ifmeanormedianisTrue. As withbarstd, but instead using percentiles for the error bars. If scalar, that percentile range is used (e.g.,90shows the 5th to 95th percentiles). IfTrue, the default percentile range of 0 to 100 is used.bardata (array-like, optional) – Valid only if
meanandmedianareFalse. If shape is 2 x N, these are the lower and upper bounds for the thin error bars. If shape is N, these are the absolute, symmetric deviations from the central points.boxes (
bool, default:None) – Shorthand forboxstd,boxstds.boxstd, boxstds, boxpctile, boxpctiles, boxdata (optional) – As with
barstd,barpctile, andbardata, but for thicker error bars representing a smaller interval than the thin error bars. IfboxstdsisTrue, the default standard deviation range of +/-1 is used. IfboxpctilesisTrue, the default percentile range of 25 to 75 is used (i.e., the interquartile range). When “boxes” and “bars” are combined, this has the effect of drawing miniature box-and-whisker plots.capsize (
float, default:rc['errorbar.capsize']=3.0) – The cap size for thin error bars in points.barz, barzorder, boxz, boxzorder (
float, default:2.5) – The “zorder” for the thin and thick error bars.barc, barcolor, boxc, boxcolor (
color-spec, default:rc['boxplot.whiskerprops.color']='black') – Colors for the thin and thick error bars.barlw, barlinewidth, boxlw, boxlinewidth (
float, default:rc['boxplot.whiskerprops.linewidth']=1.0) – Line widths for the thin and thick error bars, in points. The default for boxes is 4 timesrc['boxplot.whiskerprops.linewidth'].boxm, boxmarker (
boolormarker-spec, default:'o') – Whether to draw a small marker in the middle of the box denoting the mean or median position. Ignored ifboxesisFalse.boxms, boxmarkersize (
size-spec, default:(2 * boxlinewidth) ** 2) – The marker size for theboxmarkermarker in points ** 2.boxmc, boxmarkercolor, boxmec, boxmarkeredgecolor (
color-spec, default:'w') – Color, face color, and edge color for theboxmarkermarker.**kwargs – Passed to
matplotlib.axes.Axes.violinplot.
- violinplot(**kwargs)[source]
Plot vertical violins with a nice default style matching this matplotlib example.
- Parameters:
*args (
yorx,y) – The data passed as positional or keyword arguments. Interpreted as follows:If only
ycoordinates are passed, try to infer thexcoordinates from theSeriesorDataFrameindices or theDataArraycoordinates. Otherwise, thexcoordinates arenp.arange(0, y.shape[0]).If the
ycoordinates are a 2D array, plot each column of data in succession (except where each column of data represents a statistical distribution, as withboxplot,violinplot, or when usingmeans=Trueormedians=True).If any arguments are
pint.Quantity, auto-add the pint unit registry to matplotlib’s unit registry usingsetup_matplotlib. Apint.Quantityembedded in anxarray.DataArrayis also supported.
data (dict-like, optional) – A dict-like dataset container (e.g.,
DataFrameorDataset). If passed, each data argument can optionally be a stringkeyand the arrays used for plotting are retrieved withdata[key]. This is a native matplotlib feature.autoformat (
bool, default:rc.autoformat=True) – Whether thexaxis labels,yaxis labels, axis formatters, axes titles, legend titles, and colorbar labels are automatically configured when aSeries,DataFrame,DataArray, orQuantityis passed to the plotting command. Formatting ofpint.Quantityunit strings is controlled byrc.unitformat='L'.
- Other Parameters:
cycle (
cycle-spec, optional) – The cycle specifer, passed to theCycleconstructor. If the returned cycler is unchanged from the current cycler, the axes cycler will not be reset to its first position. To disable property cycling and just use black for the default color, usecycle=False,cycle='none', orcycle=()(analogous to disabling ticks with e.g.xformatter='none'). To restore the default property cycler, usecycle=True.lw, linewidth, linewidths (
unit-spec, default:rc['patch.linewidth']=0.6) – The edge width of the patch(es). If float, units are points. If string, interpreted byunits.ls, linestyle, linestyles (
str, default:'-') – The edge style of the patch(es).ec, edgecolor, edgecolors (
color-spec, default:'black') – The edge color of the patch(es).fc, facecolor, facecolors, fillcolor, fillcolors (
color-spec, optional) – The face color of the patch(es). The propertycycleis used by default.a, alpha, alphas (
float, optional) – The opacity of the patch(es). Inferred fromfacecolorandedgecolorby default.label, value (
floatorstr, optional) – The single legend label or colorbar coordinate to be used for this plotted element. Can be numeric or string. This is generally used with 1D positional arguments.labels, values (sequence of
floator sequence ofstr, optional) – The legend labels or colorbar coordinates used for each plotted element. Can be numeric or string, and must match the number of plotted elements. This is generally used with 2D positional arguments.showmeans, showmedians (
bool, optional) – Interpreted asmeans=Trueandmedians=Truewhen passed.showextrema (
bool, optional) – Interpreted asbarpctiles=Truewhen passed (i.e. shows minima and maxima).barstd, barstds (
bool,float, or2-tupleoffloat, optional) – Valid only ifmeanormedianisTrue. Standard deviation multiples for thin error bars with optional whiskers (i.e., caps). If scalar, then +/- that multiple is used. IfTrue, the default standard deviation range of +/-3 is used.barpctile, barpctiles (
bool,float, or2-tupleoffloat, optional) – Valid only ifmeanormedianisTrue. As withbarstd, but instead using percentiles for the error bars. If scalar, that percentile range is used (e.g.,90shows the 5th to 95th percentiles). IfTrue, the default percentile range of 0 to 100 is used.bardata (array-like, optional) – Valid only if
meanandmedianareFalse. If shape is 2 x N, these are the lower and upper bounds for the thin error bars. If shape is N, these are the absolute, symmetric deviations from the central points.boxes (
bool, default:None) – Shorthand forboxstd,boxstds.boxstd, boxstds, boxpctile, boxpctiles, boxdata (optional) – As with
barstd,barpctile, andbardata, but for thicker error bars representing a smaller interval than the thin error bars. IfboxstdsisTrue, the default standard deviation range of +/-1 is used. IfboxpctilesisTrue, the default percentile range of 25 to 75 is used (i.e., the interquartile range). When “boxes” and “bars” are combined, this has the effect of drawing miniature box-and-whisker plots.capsize (
float, default:rc['errorbar.capsize']=3.0) – The cap size for thin error bars in points.barz, barzorder, boxz, boxzorder (
float, default:2.5) – The “zorder” for the thin and thick error bars.barc, barcolor, boxc, boxcolor (
color-spec, default:rc['boxplot.whiskerprops.color']='black') – Colors for the thin and thick error bars.barlw, barlinewidth, boxlw, boxlinewidth (
float, default:rc['boxplot.whiskerprops.linewidth']=1.0) – Line widths for the thin and thick error bars, in points. The default for boxes is 4 timesrc['boxplot.whiskerprops.linewidth'].boxm, boxmarker (
boolormarker-spec, default:'o') – Whether to draw a small marker in the middle of the box denoting the mean or median position. Ignored ifboxesisFalse.boxms, boxmarkersize (
size-spec, default:(2 * boxlinewidth) ** 2) – The marker size for theboxmarkermarker in points ** 2.boxmc, boxmarkercolor, boxmec, boxmarkeredgecolor (
color-spec, default:'w') – Color, face color, and edge color for theboxmarkermarker.**kwargs – Passed to
matplotlib.axes.Axes.violinplot.
- violinploth(*args, **kwargs)[source]
Plot horizontal violins with a nice default style matching this matplotlib example.
- Parameters:
*args (
xory,x) – The data passed as positional or keyword arguments. Interpreted as follows:If only
xcoordinates are passed, try to infer theycoordinates from theSeriesorDataFrameindices or theDataArraycoordinates. Otherwise, theycoordinates arenp.arange(0, x.shape[0]).If the
xcoordinates are a 2D array, plot each column of data in succession (except where each column of data represents a statistical distribution, as withboxplot,violinplot, or when usingmeans=Trueormedians=True).If any arguments are
pint.Quantity, auto-add the pint unit registry to matplotlib’s unit registry usingsetup_matplotlib. Apint.Quantityembedded in anxarray.DataArrayis also supported.
data (dict-like, optional) – A dict-like dataset container (e.g.,
DataFrameorDataset). If passed, each data argument can optionally be a stringkeyand the arrays used for plotting are retrieved withdata[key]. This is a native matplotlib feature.autoformat (
bool, default:rc.autoformat=True) – Whether thexaxis labels,yaxis labels, axis formatters, axes titles, legend titles, and colorbar labels are automatically configured when aSeries,DataFrame,DataArray, orQuantityis passed to the plotting command. Formatting ofpint.Quantityunit strings is controlled byrc.unitformat='L'.
- Other Parameters:
cycle (
cycle-spec, optional) – The cycle specifer, passed to theCycleconstructor. If the returned cycler is unchanged from the current cycler, the axes cycler will not be reset to its first position. To disable property cycling and just use black for the default color, usecycle=False,cycle='none', orcycle=()(analogous to disabling ticks with e.g.xformatter='none'). To restore the default property cycler, usecycle=True.lw, linewidth, linewidths (
unit-spec, default:rc['patch.linewidth']=0.6) – The edge width of the patch(es). If float, units are points. If string, interpreted byunits.ls, linestyle, linestyles (
str, default:'-') – The edge style of the patch(es).ec, edgecolor, edgecolors (
color-spec, default:'black') – The edge color of the patch(es).fc, facecolor, facecolors, fillcolor, fillcolors (
color-spec, optional) – The face color of the patch(es). The propertycycleis used by default.a, alpha, alphas (
float, optional) – The opacity of the patch(es). Inferred fromfacecolorandedgecolorby default.label, value (
floatorstr, optional) – The single legend label or colorbar coordinate to be used for this plotted element. Can be numeric or string. This is generally used with 1D positional arguments.labels, values (sequence of
floator sequence ofstr, optional) – The legend labels or colorbar coordinates used for each plotted element. Can be numeric or string, and must match the number of plotted elements. This is generally used with 2D positional arguments.showmeans, showmedians (
bool, optional) – Interpreted asmeans=Trueandmedians=Truewhen passed.showextrema (
bool, optional) – Interpreted asbarpctiles=Truewhen passed (i.e. shows minima and maxima).barstd, barstds (
bool,float, or2-tupleoffloat, optional) – Valid only ifmeanormedianisTrue. Standard deviation multiples for thin error bars with optional whiskers (i.e., caps). If scalar, then +/- that multiple is used. IfTrue, the default standard deviation range of +/-3 is used.barpctile, barpctiles (
bool,float, or2-tupleoffloat, optional) – Valid only ifmeanormedianisTrue. As withbarstd, but instead using percentiles for the error bars. If scalar, that percentile range is used (e.g.,90shows the 5th to 95th percentiles). IfTrue, the default percentile range of 0 to 100 is used.bardata (array-like, optional) – Valid only if
meanandmedianareFalse. If shape is 2 x N, these are the lower and upper bounds for the thin error bars. If shape is N, these are the absolute, symmetric deviations from the central points.boxes (
bool, default:None) – Shorthand forboxstd,boxstds.boxstd, boxstds, boxpctile, boxpctiles, boxdata (optional) – As with
barstd,barpctile, andbardata, but for thicker error bars representing a smaller interval than the thin error bars. IfboxstdsisTrue, the default standard deviation range of +/-1 is used. IfboxpctilesisTrue, the default percentile range of 25 to 75 is used (i.e., the interquartile range). When “boxes” and “bars” are combined, this has the effect of drawing miniature box-and-whisker plots.capsize (
float, default:rc['errorbar.capsize']=3.0) – The cap size for thin error bars in points.barz, barzorder, boxz, boxzorder (
float, default:2.5) – The “zorder” for the thin and thick error bars.barc, barcolor, boxc, boxcolor (
color-spec, default:rc['boxplot.whiskerprops.color']='black') – Colors for the thin and thick error bars.barlw, barlinewidth, boxlw, boxlinewidth (
float, default:rc['boxplot.whiskerprops.linewidth']=1.0) – Line widths for the thin and thick error bars, in points. The default for boxes is 4 timesrc['boxplot.whiskerprops.linewidth'].boxm, boxmarker (
boolormarker-spec, default:'o') – Whether to draw a small marker in the middle of the box denoting the mean or median position. Ignored ifboxesisFalse.boxms, boxmarkersize (
size-spec, default:(2 * boxlinewidth) ** 2) – The marker size for theboxmarkermarker in points ** 2.boxmc, boxmarkercolor, boxmec, boxmarkeredgecolor (
color-spec, default:'w') – Color, face color, and edge color for theboxmarkermarker.**kwargs – Passed to
matplotlib.axes.Axes.violinplot.
- violins(*, new_obj=<function PlotAxes.violin>, message="'violins' was deprecated in version 0.8.0 and may be removed in the next major release (version 2.0.0). Please use 'violin' instead.", **kwargs)
- vlines(*args, **kwargs)[source]
Plot vertical lines.
- Parameters:
*args (
y2orx,y2, orx,y1,y2) – The data passed as positional or keyword arguments. Interpreted as follows:If only
ycoordinates are passed, try to infer thexcoordinates from theSeriesorDataFrameindices or theDataArraycoordinates. Otherwise, thexcoordinates arenp.arange(0, y2.shape[0]).If only
xandy2coordinates are passed, set they1coordinates to zero. This draws elements originating from the zero line.If both
y1andy2are provided, draw elements between these points. If either are 2D, draw elements by iterating over each column.If any arguments are
pint.Quantity, auto-add the pint unit registry to matplotlib’s unit registry usingsetup_matplotlib. Apint.Quantityembedded in anxarray.DataArrayis also supported.
data (dict-like, optional) – A dict-like dataset container (e.g.,
DataFrameorDataset). If passed, each data argument can optionally be a stringkeyand the arrays used for plotting are retrieved withdata[key]. This is a native matplotlib feature.autoformat (
bool, default:rc.autoformat=True) – Whether thexaxis labels,yaxis labels, axis formatters, axes titles, legend titles, and colorbar labels are automatically configured when aSeries,DataFrame,DataArray, orQuantityis passed to the plotting command. Formatting ofpint.Quantityunit strings is controlled byrc.unitformat='L'.
- Other Parameters:
stack, stacked (
bool, default:False) – Whether to “stack” lines from successive columns of y data or plot lines on top of each other.cycle (
cycle-spec, optional) – The cycle specifer, passed to theCycleconstructor. If the returned cycler is unchanged from the current cycler, the axes cycler will not be reset to its first position. To disable property cycling and just use black for the default color, usecycle=False,cycle='none', orcycle=()(analogous to disabling ticks with e.g.xformatter='none'). To restore the default property cycler, usecycle=True.lw, linewidth, linewidths (
unit-spec, default:rc['lines.linewidth']=1.5) – The width of the line(s). If float, units are points. If string, interpreted byunits.ls, linestyle, linestyles (
str, default:rc['lines.linestyle']='-') – The style of the line(s).c, color, colors (
color-spec, optional) – The color of the line(s). The propertycycleis used by default.a, alpha, alphas (
float, optional) – The opacity of the line(s). Inferred fromcolorby default.negpos (
bool, default:False) – Whether to shade lines whereymax >= yminwithposcolorand whereymax < yminwithnegcolor. IfTruethis function will return a length-2 silent list of handles.negcolor, poscolor (
color-spec, default:rc.negcolor='blue7',rc.poscolor='red7') – Colors to use for the negative and positive lines. Ignored ifnegposisFalse.inbounds (
bool, default:rc['axes.inbounds']=True) – Whether to restrict the defaulty(x) axis limits to account for only in-bounds data when thex(y) axis limits have been locked. See alsorc['axes.inbounds']andrc['cmap.inbounds'].label, value (
floatorstr, optional) – The single legend label or colorbar coordinate to be used for this plotted element. Can be numeric or string. This is generally used with 1D positional arguments.labels, values (sequence of
floator sequence ofstr, optional) – The legend labels or colorbar coordinates used for each plotted element. Can be numeric or string, and must match the number of plotted elements. This is generally used with 2D positional arguments.colorbar (
bool,int, orstr, optional) – If notNone, this is a location specifying where to draw an inset or outer colorbar from the resulting object(s). IfTrue, the defaultrc['colorbar.loc']='right'is used. If the same location is used in successive plotting calls, object(s) will be added to the existing colorbar in that location (valid for colorbars built from lists of artists). Valid locations are shown in incolorbar.colorbar_kw (dict-like, optional) – Extra keyword args for the call to
colorbar.legend (
bool,int, orstr, optional) – Location specifying where to draw an inset or outer legend from the resulting object(s). IfTrue, the defaultrc['legend.loc']='best'is used. If the same location is used in successive plotting calls, object(s) will be added to existing legend in that location. Valid locations are shown inlegend().legend_kw (dict-like, optional) – Extra keyword args for the call to
legend.**kwargs – Passed to
vlines.