Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit83ad856

Browse files
committed
added documentation for new mult_bar function
1 parentc20b0c2 commit83ad856

File tree

3 files changed

+161
-18
lines changed

3 files changed

+161
-18
lines changed

‎lib/matplotlib/axes/_axes.py

Lines changed: 107 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2201,6 +2201,113 @@ def barh(self, y, width, height=0.8, left=None, *, align="center",
22012201
align=align,**kwargs)
22022202
returnpatches
22032203

2204+
@docstring.dedent_interpd
2205+
defmulti_bar(self,pos,length,thickness=0.8,*,
2206+
style='grouped',orientation='vertical',**kwargs):
2207+
r"""
2208+
Make a bar plot from two dimensional data.
2209+
2210+
Call signatures::
2211+
2212+
multi_bar(pos, length, *, style='grouped', **kwargs)
2213+
multi_bar(pos, length, thickness, *, style='grouped', **kwargs)
2214+
multi_bar(pos, length, thickness, *,
2215+
style='stacked', orientation='vertical', **kwargs)
2216+
2217+
The bars are positioned at *pos* with the given style and orientation.
2218+
Their dimensions are given by *length* and *thickness*.
2219+
2220+
*length* is a 2-dimensional array (N,M) where N is the numer of
2221+
positions a M is the number of bars per position.
2222+
2223+
Parameters
2224+
----------
2225+
pos : sequence of scalars
2226+
The x or y coordinates of the bars, depending on orientation.
2227+
2228+
length : array-like of shape(N,M). The lengths of the bars.
2229+
N is the number of bar positions (same as the length of pos)
2230+
and M the number of bars per pos.
2231+
2232+
thickness : scalar or array-like, optional
2233+
The thickness(') of the bars (default: 0.8).
2234+
2235+
style : {'grouped', 'stacked'}, optional, default: 'grouped'
2236+
How of the bars at a pos are placed with respect to each other:
2237+
2238+
- 'grouped': Bars are placed next to eachother with *pos* being
2239+
the midpoint.
2240+
- 'stacked': Bars are placed on on top of another.
2241+
2242+
orientation : {'vertical', 'horizontal'}, optional
2243+
How the bars are to be oriented.
2244+
2245+
Returns
2246+
-------
2247+
`List of .BarContainer`
2248+
There are M containers in the list.
2249+
Each container has the bars created from a column of *length*
2250+
and optionally errorbars.
2251+
2252+
Other Parameters
2253+
----------------
2254+
color : scalar or array-like, optional
2255+
The colors of the bar faces.
2256+
2257+
edgecolor : scalar or array-like, optional
2258+
The colors of the bar edges.
2259+
2260+
linewidth : scalar or array-like, optional
2261+
Width of the bar edge(s). If 0, don't draw edges.
2262+
2263+
tick_label : string or array-like, optional
2264+
The tick labels of the bars.
2265+
Default: None (Use default numeric labels.)
2266+
2267+
xerr, yerr : scalar or array-like of shape(N,) or shape(2,N), optional
2268+
If not *None*, add horizontal / vertical errorbars to the bar tips.
2269+
The values are +/- sizes relative to the data:
2270+
2271+
- scalar: symmetric +/- values for all bars
2272+
- shape(N,): symmetric +/- values for each bar
2273+
- shape(2,N): separate + and - values for each bar
2274+
2275+
Default: None
2276+
2277+
ecolor : scalar or array-like, optional, default: 'black'
2278+
The line color of the errorbars.
2279+
2280+
capsize : scalar, optional
2281+
The length of the error bar caps in points.
2282+
Default: None, which will take the value from
2283+
:rc:`errorbar.capsize`.
2284+
2285+
error_kw : dict, optional
2286+
Dictionary of kwargs to be passed to the `~.Axes.errorbar`
2287+
method. Values of *ecolor* or *capsize* defined here take
2288+
precedence over the independent kwargs.
2289+
2290+
log : bool, optional, default: False
2291+
If *True*, set the y-axis to be log scale.
2292+
2293+
Notes
2294+
-----
2295+
The optional arguments *color*, *edgecolor*, *linewidth*,
2296+
*xerr*, and *yerr* can be either scalars or an array-like of shape(N,M)
2297+
matching the shape of *length*.
2298+
Detail: *xerr* and *yerr* are passed directly to
2299+
:meth:`errorbar`, so they can also have shape 2xN for
2300+
independent specification of lower and upper errors.
2301+
2302+
The optional argument *label* should be an array-like of length M.
2303+
2304+
Other optional kwargs:
2305+
2306+
%(Rectangle)s
2307+
2308+
"""
2309+
pass
2310+
22042311
@_preprocess_data(label_namer=None)
22052312
@docstring.dedent_interpd
22062313
defbroken_barh(self,xranges,yrange,**kwargs):

‎lib/matplotlib/pyplot.py

Lines changed: 53 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -2259,8 +2259,21 @@ def axvspan(xmin, xmax, ymin=0, ymax=1, **kwargs):
22592259

22602260
# Autogenerated by boilerplate.py. Do not edit as changes will be lost.
22612261
@docstring.copy_dedent(Axes.bar)
2262-
defbar(*args,data=None,**kwargs):
2263-
returngca().bar(*args,data=data,**kwargs)
2262+
defbar(
2263+
x,height,width=0.8,bottom=None,*,align='center',
2264+
data=None,**kwargs):
2265+
returngca().bar(
2266+
x=x,height=height,width=width,bottom=bottom,align=align,
2267+
data=data,**kwargs)
2268+
2269+
# Autogenerated by boilerplate.py. Do not edit as changes will be lost.
2270+
@docstring.copy_dedent(Axes.multi_bar)
2271+
defmulti_bar(
2272+
pos,length,thickness=0.8,*,style='grouped',
2273+
orientation='vertical',**kwargs):
2274+
returngca().multi_bar(
2275+
pos=pos,length=length,thickness=thickness,style=style,
2276+
orientation=orientation,**kwargs)
22642277

22652278
# Autogenerated by boilerplate.py. Do not edit as changes will be lost.
22662279
@docstring.copy_dedent(Axes.barbs)
@@ -2269,8 +2282,10 @@ def barbs(*args, data=None, **kw):
22692282

22702283
# Autogenerated by boilerplate.py. Do not edit as changes will be lost.
22712284
@docstring.copy_dedent(Axes.barh)
2272-
defbarh(*args,**kwargs):
2273-
returngca().barh(*args,**kwargs)
2285+
defbarh(y,width,height=0.8,left=None,*,align='center',**kwargs):
2286+
returngca().barh(
2287+
y=y,width=width,height=height,left=left,align=align,
2288+
**kwargs)
22742289

22752290
# Autogenerated by boilerplate.py. Do not edit as changes will be lost.
22762291
@docstring.copy_dedent(Axes.boxplot)
@@ -2496,8 +2511,8 @@ def magnitude_spectrum(
24962511

24972512
# Autogenerated by boilerplate.py. Do not edit as changes will be lost.
24982513
@docstring.copy_dedent(Axes.margins)
2499-
defmargins(*args,**kw):
2500-
returngca().margins(*args,**kw)
2514+
defmargins(*margins,x=None,y=None,tight=True):
2515+
returngca().margins(*margins,x=x,y=y,tight=tight)
25012516

25022517
# Autogenerated by boilerplate.py. Do not edit as changes will be lost.
25032518
@docstring.copy_dedent(Axes.minorticks_off)
@@ -2511,15 +2526,25 @@ def minorticks_on():
25112526

25122527
# Autogenerated by boilerplate.py. Do not edit as changes will be lost.
25132528
@_autogen_docstring(Axes.pcolor)
2514-
defpcolor(*args,data=None,**kwargs):
2515-
__ret=gca().pcolor(*args,data=data,**kwargs)
2529+
defpcolor(
2530+
*args,alpha=None,norm=None,cmap=None,vmin=None,
2531+
vmax=None,data=None,**kwargs):
2532+
__ret=gca().pcolor(
2533+
*args,alpha=alpha,norm=norm,cmap=cmap,vmin=vmin,
2534+
vmax=vmax,data=data,**kwargs)
25162535
sci(__ret)
25172536
return__ret
25182537

25192538
# Autogenerated by boilerplate.py. Do not edit as changes will be lost.
25202539
@_autogen_docstring(Axes.pcolormesh)
2521-
defpcolormesh(*args,data=None,**kwargs):
2522-
__ret=gca().pcolormesh(*args,data=data,**kwargs)
2540+
defpcolormesh(
2541+
*args,alpha=None,norm=None,cmap=None,vmin=None,
2542+
vmax=None,shading='flat',antialiased=False,data=None,
2543+
**kwargs):
2544+
__ret=gca().pcolormesh(
2545+
*args,alpha=alpha,norm=norm,cmap=cmap,vmin=vmin,
2546+
vmax=vmax,shading=shading,antialiased=antialiased,
2547+
data=data,**kwargs)
25232548
sci(__ret)
25242549
return__ret
25252550

@@ -2550,8 +2575,9 @@ def pie(
25502575

25512576
# Autogenerated by boilerplate.py. Do not edit as changes will be lost.
25522577
@docstring.copy_dedent(Axes.plot)
2553-
defplot(*args,data=None,**kwargs):
2554-
returngca().plot(*args,data=data,**kwargs)
2578+
defplot(*args,scalex=True,scaley=True,data=None,**kwargs):
2579+
returngca().plot(
2580+
*args,scalex=scalex,scaley=scaley,data=data,**kwargs)
25552581

25562582
# Autogenerated by boilerplate.py. Do not edit as changes will be lost.
25572583
@docstring.copy_dedent(Axes.plot_date)
@@ -2642,13 +2668,17 @@ def stackplot(x, *args, data=None, **kwargs):
26422668

26432669
# Autogenerated by boilerplate.py. Do not edit as changes will be lost.
26442670
@docstring.copy_dedent(Axes.stem)
2645-
defstem(*args,data=None,**kwargs):
2646-
returngca().stem(*args,data=data,**kwargs)
2671+
defstem(
2672+
*args,linefmt=None,markerfmt=None,basefmt=None,bottom=0,
2673+
label=None,data=None):
2674+
returngca().stem(
2675+
*args,linefmt=linefmt,markerfmt=markerfmt,basefmt=basefmt,
2676+
bottom=bottom,label=label,data=data)
26472677

26482678
# Autogenerated by boilerplate.py. Do not edit as changes will be lost.
26492679
@docstring.copy_dedent(Axes.step)
2650-
defstep(x,y,*args,data=None,**kwargs):
2651-
returngca().step(x=x,y=y,*args,data=data,**kwargs)
2680+
defstep(x,y,*args,where='pre',data=None,**kwargs):
2681+
returngca().step(x=x,y=y,*args,where=where,data=data,**kwargs)
26522682

26532683
# Autogenerated by boilerplate.py. Do not edit as changes will be lost.
26542684
@_autogen_docstring(Axes.streamplot)
@@ -2685,8 +2715,13 @@ def tick_params(axis='both', **kwargs):
26852715

26862716
# Autogenerated by boilerplate.py. Do not edit as changes will be lost.
26872717
@docstring.copy_dedent(Axes.ticklabel_format)
2688-
defticklabel_format(**kwargs):
2689-
returngca().ticklabel_format(**kwargs)
2718+
defticklabel_format(
2719+
*,axis='both',style='',scilimits=None,useOffset=None,
2720+
useLocale=None,useMathText=None):
2721+
returngca().ticklabel_format(
2722+
axis=axis,style=style,scilimits=scilimits,
2723+
useOffset=useOffset,useLocale=useLocale,
2724+
useMathText=useMathText)
26902725

26912726
# Autogenerated by boilerplate.py. Do not edit as changes will be lost.
26922727
@_autogen_docstring(Axes.tricontour)

‎tools/boilerplate.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -84,6 +84,7 @@ def boilerplate_gen():
8484
'axvline',
8585
'axvspan',
8686
'bar',
87+
'multi_bar',
8788
'barbs',
8889
'barh',
8990
'boxplot',

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp