Movatterモバイル変換


[0]ホーム

URL:


You are reading an old version of the documentation (v2.0.0). For the latest version seehttps://matplotlib.org/stable/api/axes_api.html
matplotlib

Navigation


Travis-CI:

Table Of Contents

Related Topics

This Page

Quick search

Axes class

classmatplotlib.axes.Axes(fig,rect,facecolor=None,frameon=True,sharex=None,sharey=None,label='',xscale=None,yscale=None,axisbg=None,**kwargs)

TheAxes contains most of the figure elements:Axis,Tick,Line2D,Text,Polygon, etc., and sets thecoordinate system.

TheAxes instance supports callbacks through a callbacksattribute which is aCallbackRegistryinstance. The events you can connect to are ‘xlim_changed’ and‘ylim_changed’ and the callback will be called with func(ax)whereax is theAxes instance.

Plotting

Basic

Axes.plotPlot lines and/or markers to theAxes.
Axes.errorbarPlot an errorbar graph.
Axes.scatterMake a scatter plot ofx vsy
Axes.plot_dateA plot with data that contains dates.
Axes.stepMake a step plot.
Axes.loglogMake a plot with log scaling on both thex andy axis.
Axes.semilogxMake a plot with log scaling on thex axis.
Axes.semilogyMake a plot with log scaling on they axis.
Axes.fill_betweenMake filled polygons between two curves.
Axes.fill_betweenxMake filled polygons between two horizontal curves.
Axes.barMake a bar plot.
Axes.barhMake a horizontal bar plot.
Axes.stemCreate a stem plot.
Axes.eventplotPlot identical parallel lines at specific positions.
Axes.piePlot a pie chart.
Axes.stackplotDraws a stacked area plot.
Axes.broken_barhPlot horizontal bars.
Axes.vlinesPlot vertical lines.
Axes.hlinesPlot horizontal lines at eachy fromxmin toxmax.
Axes.fillPlot filled polygons.

Spans

Axes.axhlineAdd a horizontal line across the axis.
Axes.axhspanAdd a horizontal span (rectangle) across the axis.
Axes.axvlineAdd a vertical line across the axes.
Axes.axvspanAdd a vertical span (rectangle) across the axes.

Spectral

Axes.acorrPlot the autocorrelation ofx.
Axes.angle_spectrumPlot the angle spectrum.
Axes.coherePlot the coherence betweenx andy.
Axes.csdPlot the cross-spectral density.
Axes.magnitude_spectrumPlot the magnitude spectrum.
Axes.phase_spectrumPlot the phase spectrum.
Axes.psdPlot the power spectral density.
Axes.specgramPlot a spectrogram.
Axes.xcorrPlot the cross correlation betweenx andy.

Statistics

Axes.boxplotMake a box and whisker plot.
Axes.violinplotMake a violin plot.
Axes.violinDrawing function for violin plots.
Axes.bxpDrawing function for box and whisker plots.

Binned

Axes.hexbinMake a hexagonal binning plot.
Axes.histPlot a histogram.
Axes.hist2dMake a 2D histogram plot.

Contours

Axes.clabelLabel a contour plot.
Axes.contourPlot contours.
Axes.contourfPlot contours.

Array

Axes.imshowDisplay an image on the axes.
Axes.matshowPlot a matrix or array as an image.
Axes.pcolorCreate a pseudocolor plot of a 2-D array.
Axes.pcolorfastpseudocolor plot of a 2-D array
Axes.pcolormeshPlot a quadrilateral mesh.
Axes.spyPlot the sparsity pattern on a 2-D array.

Unstructured Triangles

Axes.tripcolorCreate a pseudocolor plot of an unstructured triangular grid.
Axes.triplotDraw a unstructured triangular grid as lines and/or markers.
Axes.tricontourDraw contours on an unstructured triangular grid.
Axes.tricontourfDraw contours on an unstructured triangular grid.

Text and Annotations

Axes.annotateAnnotate the pointxy with texts.
Axes.textAdd text to the axes.
Axes.tableAdd a table to the current axes.
Axes.arrowAdd an arrow to the axes.

Fields

Axes.barbsPlot a 2-D field of barbs.
Axes.quiverPlot a 2-D field of arrows.
Axes.quiverkeyAdd a key to a quiver plot.
Axes.streamplotDraws streamlines of a vector flow.

Clearing

Axes.claClear the current axes.
Axes.clearclear the axes

Appearance

Axes.axisSet axis properties.
Axes.set_axis_offturn off the axis
Axes.set_axis_onturn on the axis
Axes.set_frame_onSet whether the axes rectangle patch is drawn
Axes.get_frame_onGet whether the axes rectangle patch is drawn
Axes.set_axisbelowSet whether the axis ticks and gridlines are above or below most
Axes.get_axisbelowGet whether axis below is true or not
Axes.gridTurn the axes grids on or off.
Axes.get_axis_bgcolor

Deprecated since version 2.0.

Axes.get_facecolor
Axes.get_fc
Axes.set_facecolor
Axes.set_fc
Axes.set_axis_bgcolor

Deprecated since version 2.0.

Property cycle

Axes.set_prop_cycleSet the property cycle for any future plot commands on this Axes.
Axes.set_color_cycleSet the color cycle for any future plot commands on this Axes.

Axis / limits

Axes.get_yaxisReturn the YAxis instance
Axes.get_xaxisReturn the XAxis instance

Axis Limits and direction

Axes.invert_xaxisInvert the x-axis.
Axes.invert_yaxisInvert the y-axis.
Axes.xaxis_invertedReturnsTrue if the x-axis is inverted.
Axes.yaxis_invertedReturnsTrue if the y-axis is inverted.
Axes.set_xlimSet the data limits for the x-axis
Axes.set_ylimSet the data limits for the y-axis
Axes.get_ylimGet the y-axis range
Axes.get_xlimGet the x-axis range
Axes.update_datalimUpdate the data lim bbox with seq of xy tups or equiv.
Axes.update_datalim_boundsUpdate the datalim to include the given
Axes.update_datalim_numerix

Deprecated since version 2.0.

Axes.set_yboundSet the lower and upper numerical bounds of the y-axis.
Axes.set_xboundSet the lower and upper numerical bounds of the x-axis.
Axes.get_yboundReturn y-axis numerical bounds in the form of
Axes.get_xboundReturns the x-axis numerical bounds

Axis Labels, title, and legend

Axes.get_xlabelGet the xlabel text string.
Axes.get_ylabelGet the ylabel text string.
Axes.set_xlabelSet the label for the xaxis.
Axes.set_ylabelSet the label for the yaxis
Axes.set_titleSet a title for the axes.
Axes.get_titleGet an axes title.
Axes.legendPlaces a legend on the axes.
Axes.get_legendReturn the legend.Legend instance, or None if no legend is defined
Axes.get_legend_handles_labelsReturn handles and labels for legend

Axis scales

Axes.set_xscaleSet the x-axis scale
Axes.get_xscaleReturn the xaxis scale string: linear, log, logit, symlog
Axes.get_yscaleReturn the yaxis scale string: linear, log, logit, symlog
Axes.set_yscaleSet the y-axis scale

Autoscaling and margins

Axes.use_sticky_edgesWhen autoscaling, whether to obey allArtist.sticky_edges.
Axes.marginsSet or retrieve autoscaling margins.
Axes.set_xmarginSet padding of X data limits prior to autoscaling.
Axes.set_ymarginSet padding of Y data limits prior to autoscaling.
Axes.relimRecompute the data limits based on current artists.
Axes.autoscaleAutoscale the axis view to the data (toggle).
Axes.autoscale_viewAutoscale the view limits using the data limits.
Axes.get_autoscale_onGet whether autoscaling is applied for both axes on plot commands
Axes.set_autoscale_onSet whether autoscaling is applied on plot commands
Axes.get_autoscalex_onGet whether autoscaling for the x-axis is applied on plot commands
Axes.set_autoscalex_onSet whether autoscaling for the x-axis is applied on plot commands
Axes.get_autoscaley_onGet whether autoscaling for the y-axis is applied on plot commands
Axes.set_autoscaley_onSet whether autoscaling for the y-axis is applied on plot commands

Aspect ratio

Axes.apply_aspectUse_aspect() and_adjustable() to modify the axes box or the view limits.
Axes.get_aspect
Axes.set_aspectaspect
Axes.get_adjustable
Axes.set_adjustableACCEPTS: [ ‘box’ | ‘datalim’ | ‘box-forced’]

Ticks and tick labels

Axes.xaxis_dateSets up x-axis ticks and labels that treat the x data as dates.
Axes.yaxis_dateSets up y-axis ticks and labels that treat the y data as dates.
Axes.get_xmajorticklabelsGet the xtick labels as a list ofText instances.
Axes.get_xminorticklabelsGet the x minor tick labels as a list ofmatplotlib.text.Text instances.
Axes.get_xticklabelsGet the x tick labels as a list ofText instances.
Axes.get_xticklinesGet the xtick lines as a list of Line2D instances
Axes.get_xticksReturn the x ticks as a list of locations
Axes.get_ymajorticklabelsGet the major y tick labels as a list ofText instances.
Axes.get_yminorticklabelsGet the minor y tick labels as a list ofText instances.
Axes.get_yticklabelsGet the x tick labels as a list ofText instances.
Axes.get_yticklinesGet the ytick lines as a list of Line2D instances
Axes.get_yticksReturn the y ticks as a list of locations
Axes.minorticks_offRemove minor ticks from the axes.
Axes.minorticks_onAdd autoscaling minor ticks to the axes.
Axes.set_xticklabelsSet the xtick labels with list of stringslabels
Axes.set_xticksSet the x ticks with list ofticks
Axes.set_yticklabelsSet the y tick labels with list of stringslabels
Axes.set_yticksSet the y ticks with list ofticks
Axes.get_xgridlinesGet the x grid lines as a list of Line2D instances
Axes.get_ygridlinesGet the y grid lines as a list of Line2D instances
Axes.ticklabel_formatChange theScalarFormatter used by default for linear axes.
Axes.tick_paramsChange the appearance of ticks and tick labels.
Axes.locator_paramsControl behavior of tick locators.

Units

Axes.convert_xunitsFor artists in an axes, if the xaxis has units support,
Axes.convert_yunitsFor artists in an axes, if the yaxis has units support,
Axes.have_unitsReturnTrue if units are set on thex ory axes

Adding Artists

Axes.add_artistAdd anyArtist to the axes.
Axes.add_collectionAdd aCollection instance to the axes.
Axes.add_containerAdd aContainer instance to the axes.
Axes.add_imageAdd aAxesImage to the axes.
Axes.add_lineAdd aLine2D to the list of plot
Axes.add_patchAdd aPatchp to the list of axes patches; the clipbox will be set to the Axes clipping box.
Axes.add_tableAdd aTable instance to the

Twinning

Axes.twinxCreate a twin Axes sharing the xaxis
Axes.twinyCreate a twin Axes sharing the yaxis
Axes.get_shared_x_axesReturn a copy of the shared axes Grouper object for x axes
Axes.get_shared_y_axesReturn a copy of the shared axes Grouper object for y axes

Axes Position

Axes.get_anchor
Axes.set_anchoranchor
Axes.get_axes_locatorreturn axes_locator
Axes.set_axes_locatorset axes_locator
Axes.reset_positionMake the original position the active position
Axes.get_positionReturn the a copy of the axes rectangle as a Bbox
Axes.set_positionSet the axes position

Async/Event based

Axes.staleIf the artist is ‘stale’ and needs to be re-drawn for the output to match the internal state of the artist.
Axes.pchangedFire an event when property changed, calling all of the registered callbacks.
Axes.add_callbackAdds a callback function that will be called whenever one of theArtist‘s properties changes.
Axes.remove_callbackRemove a callback based on itsid.

Interactive

Axes.can_panReturnTrue if this axes supports any pan/zoom button functionality.
Axes.can_zoomReturnTrue if this axes supports the zoom box button functionality.
Axes.get_navigateGet whether the axes responds to navigation commands
Axes.set_navigateSet whether the axes responds to navigation toolbar commands
Axes.get_navigate_modeGet the navigation toolbar button status: ‘PAN’, ‘ZOOM’, or None
Axes.set_navigate_modeSet the navigation toolbar button status;
Axes.start_panCalled when a pan operation has started.
Axes.drag_panCalled when the mouse moves during a pan operation.
Axes.end_panCalled when a pan operation completes (when the mouse button
Axes.format_coordReturn a format string formatting thex,y coord
Axes.format_cursor_dataReturncursor data string formatted.
Axes.format_xdataReturnx string formatted.
Axes.format_ydataReturn y string formatted.
Axes.hitlistList the children of the artist which contain the mouse eventevent.
Axes.mouseover
Axes.in_axesReturnTrue if the givenmouseevent (in display coords)
Axes.pickTrigger pick event
Axes.pickableReturnTrue ifArtist is pickable.
Axes.get_pickerReturn the picker object used by this artist
Axes.set_pickerSet the epsilon for picking used by this artist
Axes.set_containsReplace the contains test used by this artist.
Axes.get_containsReturn the _contains test used by the artist, orNone for default.
Axes.containsTest whether the mouse event occured in the axes.
Axes.contains_pointReturnsTrue if the point (tuple of x,y) is inside the axes (the area defined by the its patch).
Axes.get_cursor_dataGet the cursor data for a given event.
Axes.get_cursor_propsReturn the cursor propertiess as a (linewidth,color)
Axes.set_cursor_propsSet the cursor property as

Children

Axes.get_childrenreturn a list of child artists
Axes.get_imagesreturn a list of Axes images contained by the Axes
Axes.get_linesReturn a list of lines contained by the Axes
Axes.findobjFind artist objects.

Drawing

Axes.drawDraw everything (plot lines, axes, labels)
Axes.draw_artistThis method can only be used after an initial draw which caches the renderer.
Axes.redraw_in_frameThis method can only be used after an initial draw which caches the renderer.
Axes.get_renderer_cache
Axes.get_rasterization_zorderGet zorder value below which artists will be rasterized
Axes.set_rasterization_zorderSet zorder value below which artists will be rasterized.
Axes.get_window_extentget the axes bounding box in display space;args and
Axes.get_tightbboxReturn the tight bounding box of the axes.

Bulk property manipulation

Axes.setA property batch setter.
Axes.updateUpdate the properties of thisArtist from the dictionaryprop.
Axes.propertiesreturn a dictionary mapping property name -> value for all Artist props
Axes.update_fromCopy properties fromother toself.

General Artist Properties

Axes.set_alphaSet the alpha value used for blending - not supported on all backends.
Axes.set_animatedSet the artist’s animation state.
Axes.set_clip_boxSet the artist’s clipBbox.
Axes.set_clip_onSet whether artist uses clipping.
Axes.set_clip_pathSet the artist’s clip path, which may be:
Axes.set_gidSets the (group) id for the artist
Axes.set_labelSet the label tos for auto legend.
Axes.set_urlSets the url for the artist
Axes.set_visibleSet the artist’s visiblity.
Axes.set_zorderSet the zorder for the artist.
Axes.set_rasterizedForce rasterized (bitmap) drawing in vector backend output.
Axes.set_sketch_paramsSets the sketch parameters.
Axes.set_agg_filterset agg_filter fuction.
Axes.set_snapSets the snap setting which may be:
Axes.set_transformSet theTransform instance used by this artist.
Axes.set_path_effectsset path_effects, which should be a list of instances of
Axes.get_agg_filterreturn filter function to be used for agg filter
Axes.get_sketch_paramsReturns the sketch parameters for the artist.
Axes.get_alphaReturn the alpha value used for blending - not supported on all
Axes.get_animatedReturn the artist’s animated state
Axes.get_clip_boxReturn artist clipbox
Axes.get_clip_onReturn whether artist uses clipping
Axes.get_clip_pathReturn artist clip path
Axes.get_gidReturns the group id
Axes.get_labelGet the label used for this artist in the legend.
Axes.get_urlReturns the url
Axes.get_visibleReturn the artist’s visiblity
Axes.get_zorderReturn theArtist‘s zorder.
Axes.get_rasterizedreturn True if the artist is to be rasterized
Axes.get_transformReturn theTransform instance used by this artist.
Axes.get_snapReturns the snap setting which may be:
Axes.get_path_effects
Axes.axesTheAxes instance the artist resides in, orNone.
Axes.get_axesReturn theAxes instance the artist resides in, orNone.
Axes.set_axesSet theAxes instance in which the artist resides, if any.
Axes.set_figureSet the class:Axes figure
Axes.get_figureReturn theFigure instance the artist belongs to.

Artist Methods

Axes.is_figure_setReturns True if the artist is assigned to aFigure.
Axes.removeRemove the artist from the figure if possible.
Axes.is_transform_setReturnsTrue ifArtist has a transform explicitly set.

Projection

Methods used byAxis that must be overridden fornon-rectilinear Axes.

Axes.name
Axes.get_xaxis_transformGet the transformation used for drawing x-axis labels, ticks and gridlines.
Axes.get_yaxis_transformGet the transformation used for drawing y-axis labels, ticks and gridlines.
Axes.get_data_ratioReturns the aspect ratio of the raw data.
Axes.get_data_ratio_logReturns the aspect ratio of the raw data in log scale.
Axes.get_xaxis_text1_transformGet the transformation used for drawing x-axis labels, which will add the given amount of padding (in points) between the axes and the label.
Axes.get_xaxis_text2_transformGet the transformation used for drawing the secondary x-axis labels, which will add the given amount of padding (in points) between the axes and the label.
Axes.get_yaxis_text1_transformGet the transformation used for drawing y-axis labels, which will add the given amount of padding (in points) between the axes and the label.
Axes.get_yaxis_text2_transformGet the transformation used for drawing the secondary y-axis labels, which will add the given amount of padding (in points) between the axes and the label.

Other

Axes.zorder
Axes.aname
Axes.get_default_bbox_extra_artists
Axes.get_transformed_clip_path_and_affineReturn the clip path with the non-affine part of its transformation applied, and the remaining affine part of its transformation.
Axes.has_dataReturnTrue if any artists have been added to axes.
Axes.hold

Deprecated since version 2.0.

Axes.ishold

Deprecated since version 2.0.

© Copyright 2002 - 2012 John Hunter, Darren Dale, Eric Firing, Michael Droettboom and the Matplotlib development team; 2012 - 2016 The Matplotlib development team. Last updated on Feb 20, 2017. Created usingSphinx 1.5.2.

[8]ページ先頭

©2009-2025 Movatter.jp