日韩性视频-久久久蜜桃-www中文字幕-在线中文字幕av-亚洲欧美一区二区三区四区-撸久久-香蕉视频一区-久久无码精品丰满人妻-国产高潮av-激情福利社-日韩av网址大全-国产精品久久999-日本五十路在线-性欧美在线-久久99精品波多结衣一区-男女午夜免费视频-黑人极品ⅴideos精品欧美棵-人人妻人人澡人人爽精品欧美一区-日韩一区在线看-欧美a级在线免费观看

歡迎訪問 生活随笔!

生活随笔

當前位置: 首頁 > 编程语言 > python >内容正文

python

python matplotlib.figure.Figure.add_subplot()方法的使用

發(fā)布時間:2025/3/19 python 30 豆豆
生活随笔 收集整理的這篇文章主要介紹了 python matplotlib.figure.Figure.add_subplot()方法的使用 小編覺得挺不錯的,現(xiàn)在分享給大家,幫大家做個參考.

官方文檔
https://matplotlib.org/api/_as_gen/matplotlib.figure.Figure.html?highlight=add_subplot#matplotlib.figure.Figure.add_subplot

本地doc:

Signature: figure.add_subplot(*args, **kwargs) Docstring: Add an `~.axes.Axes` to the figure as part of a subplot arrangement. 作為子圖布置的一部分,在圖中添加一個?.axes.Axes。Call signatures::add_subplot(nrows, ncols, index, **kwargs)add_subplot(pos, **kwargs)add_subplot(ax)add_subplot()Parameters ---------- *argsEither a 3-digit integer or three separate integersdescribing the position of the subplot. If the threeintegers are *nrows*, *ncols*, and *index* in order, thesubplot will take the *index* position on a grid with *nrows*rows and *ncols* columns. *index* starts at 1 in the upper leftcorner and increases to the right.*pos* is a three digit integer, where the first digit is thenumber of rows, the second the number of columns, and the thirdthe index of the subplot. i.e. fig.add_subplot(235) is the same asfig.add_subplot(2, 3, 5). Note that all integers must be less than10 for this form to work.If no positional arguments are passed, defaults to (1, 1, 1).In rare circumstances, `.add_subplot` may be called with a singleargument, a subplot axes instance already created in thepresent figure but not in the figure's list of axes.projection : {None, 'aitoff', 'hammer', 'lambert', 'mollweide', 'polar', 'rectilinear', str}, optionalThe projection type of the subplot (`~.axes.Axes`). *str* is thename of a custom projection, see `~matplotlib.projections`. Thedefault None results in a 'rectilinear' projection.polar : boolean, optionalIf True, equivalent to projection='polar'.sharex, sharey : `~.axes.Axes`, optionalShare the x or y `~matplotlib.axis` with sharex and/or sharey.The axis will have the same limits, ticks, and scale as the axisof the shared axes.label : strA label for the returned axes.Other Parameters ---------------- **kwargsThis method also takes the keyword arguments forthe returned axes base class. The keyword arguments for therectilinear base class `~.axes.Axes` can be found inthe following table but there might also be other keywordarguments if another projection is used.adjustable: {'box', 'datalim'}agg_filter: a filter function, which takes a (m, n, 3) float array and a dpi value, and returns a (m, n, 3) arrayalpha: floatanchor: 2-tuple of floats or {'C', 'SW', 'S', 'SE', ...}animated: boolaspect: {'auto', 'equal'} or numautoscale_on: boolautoscalex_on: boolautoscaley_on: boolaxes_locator: Callable[[Axes, Renderer], Bbox]axisbelow: bool or 'line'clip_box: `.Bbox`clip_on: boolclip_path: [(`~matplotlib.path.Path`, `.Transform`) | `.Patch` | None]contains: callablefacecolor: colorfc: colorfigure: `.Figure`frame_on: boolgid: strin_layout: boollabel: objectnavigate: boolnavigate_mode: unknownpath_effects: `.AbstractPathEffect`picker: None or bool or float or callableposition: [left, bottom, width, height] or `~matplotlib.transforms.Bbox`rasterization_zorder: float or Nonerasterized: bool or Nonesketch_params: (scale: float, length: float, randomness: float)snap: bool or Nonetitle: strtransform: `.Transform`url: strvisible: boolxbound: unknownxlabel: strxlim: (left: float, right: float)xmargin: float greater than -0.5xscale: {"linear", "log", "symlog", "logit", ...}xticklabels: List[str]xticks: listybound: unknownylabel: strylim: (bottom: float, top: float)ymargin: float greater than -0.5yscale: {"linear", "log", "symlog", "logit", ...}yticklabels: List[str]yticks: listzorder: floatReturns ------- axes : `.axes.SubplotBase`, or another subclass of `~.axes.Axes`The axes of the subplot. The returned axes base class depends onthe projection used. It is `~.axes.Axes` if rectilinear projectionare used and `.projections.polar.PolarAxes` if polar projectionare used. The returned axes is then a subplot subclass of thebase class.Notes ----- If the figure already has a subplot with key (*args*, *kwargs*) then it will simply make that subplot current and return it. This behavior is deprecated. Meanwhile, if you do not want this behavior (i.e., you want to force the creation of a new subplot), you must use a unique set of args and kwargs. The axes *label* attribute has been exposed for this purpose: if you want two subplots that are otherwise identical to be added to the figure, make sure you give them unique labels.See Also -------- .Figure.add_axes .pyplot.subplot .pyplot.axes .Figure.subplots .pyplot.subplotsExamples -------- ::fig = plt.figure()fig.add_subplot(221)# equivalent but more generalax1 = fig.add_subplot(2, 2, 1)# add a subplot with no frameax2 = fig.add_subplot(222, frameon=False)# add a polar subplotfig.add_subplot(223, projection='polar')# add a red subplot that share the x-axis with ax1fig.add_subplot(224, sharex=ax1, facecolor='red')#delete x2 from the figurefig.delaxes(ax2)#add x2 to the figure againfig.add_subplot(ax2) File: c:\users\huawei\appdata\local\programs\python\python36\lib\site-packages\matplotlib\figure.py Type: method

總結(jié)

以上是生活随笔為你收集整理的python matplotlib.figure.Figure.add_subplot()方法的使用的全部內(nèi)容,希望文章能夠幫你解決所遇到的問題。

如果覺得生活随笔網(wǎng)站內(nèi)容還不錯,歡迎將生活随笔推薦給好友。