Bases:
3D Axes object. The parent figure. The The
elevation angle in degrees rotates the camera above and below the x-y plane, with a positive angle corresponding to a location above the plane. The azimuthal angle in degrees rotates the camera about the z axis, with a positive angle corresponding to a right-handed rotation. In other words, a positive azimuth rotates the camera about the origin from its location along the +x axis towards the +y axis. The roll angle in degrees rotates the camera about the viewing axis. A positive angle spins the camera clockwise, causing the scene to rotate counter-clockwise. Other Axes to share z-limits with. The projection type, default 'persp'. Changes the physical dimensions of the Axes3D, such that the ratio of the axis lengths in display units is x:y:z. If None, defaults to 4:4:3 If True, the draw order is computed based on the average position of the Prior to
Matplotlib 3.4 Axes3D would add themselves to their host Figure on init. Other Axes class do not do this. This behavior is deprecated in 3.4, the default is changed to False in 3.6. The keyword will be undocumented and a non-False value will be an error in 3.7. For a projection type of 'persp', the focal length of the virtual camera. Must be > 0. If None, defaults to 1. For a projection type of
'ortho', must be set to either None or infinity (numpy.inf). If None, defaults to infinity. The focal length can be computed from a desired Field Of View via the equation: focal_length = 1/tan(FOV/2) Other optional keyword arguments: 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 scalar or None (float, float) or {'C', 'SW', 'S', 'SE', 'E', 'NE', ...} bool {'auto', 'equal', 'equalxy', 'equalxz', 'equalyz'} bool unknown unknown unknown Callable[[Axes, Renderer], Bbox] bool or 'line' 3-tuple of floats or None bool Patch or (Path, Transform) or None color bool str bool object bool bool unknown None or bool or float or callable [left, bottom, width, height] or {'persp', 'ortho'} unknown float or None bool (scale: float, length: float, randomness: float) bool or None unknown str bool unknown str (bottom: float, top: float) (bottom: float, top: float) float greater than -0.5 unknown unknown unknown unknown str (bottom: float, top: float) (bottom: float, top: float) float greater than -0.5 unknown unknown unknown unknown unknown unknown float greater than -0.5 float unknown unknown unknown Add a 3D
collection object to the plot. 2D collection types are converted to a 3D version by modifying the object and adding z coordinate information. Supported are: PolyCollection LineCollection PatchCollection Adjust the Axes for a specified data aspect ratio. Depending on If not Notes This is called automatically when each Axes is drawn. You may need to call it yourself if you need to update the Axes position and/or view limits before the Figure is drawn. Convenience method
for simple axis view autoscaling. See Autoscale the
view limits using the data limits. See Add 2D bar(s). The x coordinates of the left sides of the bars. The height of the bars. Z coordinate of bars; if a single value is specified, it will be used for all bars. When plotting 2D data, the
direction to use as z ('x', 'y' or 'z'). If given, all parameters also accept a string Other arguments are forwarded to
Generate a 3D barplot. This method creates
three dimensional barplot where the width, depth, height, and color of the bars can all be uniquely set. The coordinates of the anchor point of the bars. The width, depth, and height of the bars, respectively. The color
of the bars can be specified globally or individually. This parameter can be: A single color, to color all bars the same color. An array of colors of length N bars, to color each bar independently. An array of colors of length 6, to color the faces of the bars similarly. An array of colors of length 6 * N bars, to color each face independently. When coloring the faces of the boxes specifically, this is the order of the
coloring: -Z (bottom of box) +Z (top of box) -Y +Y -X +X The z-axis sorting scheme passed onto When true, this shades the dark sides of the bars (relative to the plot's source of light). The lightsource to use when shade is True. If given, all parameters also accept a string Any additional keyword arguments are passed onto Poly3DCollection A collection of three dimensional polygons representing the bars. can_pan()[source]#Return whether this Axes supports the pan/zoom button functionality. Axes3d objects do not use the pan/zoom button. can_zoom()[source]#Return whether this Axes supports the zoom box button functionality. Axes3D objects do not use the zoom box button. clabel(*args, **kwargs)[source]#Currently not implemented for 3D axes, and returns None. clear()[source]#Clear the Axes. contour(X, Y, Z, *args, extend3d=False, stride=5, zdir='z', offset=None, data=None, **kwargs)[source]#Create a 3D contour plot. Parameters: X, Y, Zarray-like,Input data. See Whether to extend contour in 3D. strideintStep size for extending contour. zdir{'x', 'y', 'z'}, default: 'z'The direction to use. offsetfloat, optionalIf specified, plot a projection of the contour lines at this position in a plane normal to zdir. dataindexable object, optionalIf given, all parameters also accept a string Other arguments are forwarded to Create a 3D contour plot. Parameters: X, Y, Zarray-like,Input data. See Whether to extend contour in 3D. strideintStep size for extending contour. zdir{'x', 'y', 'z'}, default: 'z'The direction to use. offsetfloat, optionalIf specified, plot a projection of the contour lines at this position in a plane normal to zdir. dataindexable object, optionalIf given, all parameters also accept a string Other arguments are forwarded to Create a 3D filled contour plot. Parameters: X, Y, Zarray-likeInput data. See The direction to use. offsetfloat, optionalIf specified, plot a projection of the contour lines at this position in a plane normal to zdir. dataindexable object, optionalIf given, all parameters also accept a string Other arguments are forwarded to
Create a 3D filled contour plot. Parameters: X, Y, Zarray-likeInput data. See The direction to use. offsetfloat, optionalIf specified, plot a projection of the contour lines at this position in a plane normal to zdir. dataindexable object, optionalIf given, all parameters also accept a string Other arguments are forwarded to
For artists in an Axes, if the zaxis has units support, convert z using zaxis unit type disable_mouse_rotation()[source]#Disable mouse buttons for 3D rotation and zooming. propertydist[source]# draw(renderer)[source]#Draw the Artist (and its children) using the given renderer. This has no effect if the artist is not visible ( RendererBase subclass.Notes This method is overridden in the Artist subclasses. errorbar(x, y, z, zerr=None, yerr=None, xerr=None, fmt='', barsabove=False, errorevery=1, ecolor=None, elinewidth=None, capsize=None, capthick=None, xlolims=False, xuplims=False, ylolims=False, yuplims=False, zlolims=False, zuplims=False, *, data=None, **kwargs)[source]#Plot lines and/or markers with errorbars around them. x/y/z define the data locations, and xerr/yerr/zerr define the errorbar sizes. By default, this draws the data markers/lines as well the errorbars. Use fmt='none' to draw errorbars only. Parameters:x, y, zfloat or array-likeThe data positions. xerr, yerr, zerrfloat or array-like, shape (N,) or (2, N), optionalThe errorbar sizes:
Note that all error arrays should have positive values. fmtstr, default: ''The format for the data points / data lines. See Use 'none' (case insensitive) to plot errorbars without any data markers. ecolorcolor, default: NoneThe color of the errorbar lines. If None, use the color of the line connecting the markers. elinewidthfloat, default: NoneThe linewidth of the errorbar lines. If None, the linewidth of the current style is used. capsizefloat, default:rcParams["errorbar.capsize"] (default: 0.0 )The length of the error bar caps in points. capthickfloat, default: NoneAn alias to the keyword argument markeredgewidth (a.k.a. mew). This setting is a more sensible name for the property that controls the thickness of the error bar cap in points. For backwards compatibility, if mew or markeredgewidth are given, then they will over-ride capthick. This may change in future releases. barsabovebool, default: FalseIf True, will plot the errorbars above the plot symbols. Default is below. xlolims, ylolims, zlolimsbool, default: FalseThese arguments can be used to indicate that a value gives only lower limits. In that case a caret symbol is used to indicate this. lims-arguments may be scalars, or array-likes of the same length as the errors. To use limits with inverted axes,
Same as above, but for controlling the upper limits. erroreveryint or (int, int), default: 1draws error bars on a subset of the data. errorevery =N draws error bars on the points (x[::N], y[::N], z[::N]). errorevery =(start, N) draws error bars on the points (x[start::N], y[start::N], z[start::N]). e.g. errorevery=(6, 3) adds error bars to the data at (x[6], x[9], x[12], x[15], ...). Used to avoid overlapping error bars when two series share x-axis values. Returns:errlineslistList of List of List of
If given, the following parameters also accept a string x, y, z, xerr, yerr, zerr **kwargsAll other keyword arguments for styling errorbar lines are passed Examples (Source code, png) format_coord(xd, yd)[source]#Given the 2D view coordinates attempt to guess a 3D coordinate. Looks for the nearest edge to the point and then assumes that the point is at the same z location as the nearest point on the edge. format_zdata(z)[source]#Return z string
formatted. This function will use the Return whether the zaxis is autoscaled. get_axis_position()[source]# get_frame_on()[source]#Get whether the 3D axes panels are drawn. get_proj()[source]#Create the projection matrix from the current viewing position. get_tightbbox(renderer=None, call_axes_locator=True, bbox_extra_artists=None, *, for_layout_only=False)[source]#Return the tight bounding box of the Axes, including axis and their decorators (xlabel, title, etc). Artists that have RendererBase subclassrenderer that will be used to draw the figures (i.e.
Artist or None List of artists to include in the tight bounding box. If If
call_axes_locator is The bounding box will not include the x-extent of the title and the xlabel, or the y-extent of the ylabel. Returns:BboxBase Bounding box in figure pixel coordinates. get_w_lims()[source]#Get 3D world limits. get_xlim()[source]#Return the x-axis view limits. Returns:left, right(float, float)The current x-axis limits in data coordinates. See also Axes.set_xlim set_xbound , get_xbound invert_xaxis , xaxis_inverted
Notes The x-axis may be inverted, in which case the left value will be greater than the right value. get_xlim3d()[source]#Alias for
Return the y-axis view limits. Returns: bottom, top(float, float)The current y-axis limits in data coordinates. See also Axes.set_ylim set_ybound , get_ybound invert_yaxis , yaxis_inverted Notes The y-axis may be inverted, in which case the bottom value will be greater than the top value. get_ylim3d()[source]#Alias for
Return the Return the lower and upper z-axis bounds, in increasing order. get_zgridlines()[source]#Return the zaxis' grid lines as a list of Get the z-label text string. get_zlim()[source]#Get 3D z limits. get_zlim3d()[source]#Alias for Return the zaxis' major tick labels, as a list of Return the zaxis' minor tick labels, as a list of Return the zaxis' scale (as a str). get_zticklabels(minor=False, which=None)[source]#Get the zaxis' tick labels. Parameters:minorboolWhether to return the minor or the major ticklabels. whichNone, ('minor', 'major', 'both')Overrides minor. Selects which ticklabels to return Returns:list ofText
get_zticklines(minor=False)[source]#Return the zaxis' tick lines as a list of Return the zaxis' tick locations in data coordinates. The locations are not clipped to the current axis limits and hence may contain locations that are not visible in the output. Parameters:minorbool, default: FalseTrue to return the minor tick directions, False to return the major tick directions. Returns:numpy array of tick locations grid(visible=True, **kwargs)[source]#Set / unset 3D grid. Note Currently,
this function does not behave the same as Invert the z-axis. margins(*margins, x=None, y=None, z=None, tight=True)[source]#Set or retrieve autoscaling margins. See Set the mouse buttons for 3D rotation and zooming. Parameters:rotate_btnint or list of int, default: 1The mouse button or buttons to use for 3D rotation of the axes. zoom_btnint or list of int, default: 3The mouse button or buttons to use to zoom the 3D axes. name='3d'# plot(xs, ys, *args, zdir='z', **kwargs)[source]#Plot 2D or 3D data. Parameters: xs1D array-likex coordinates of vertices. ys1D array-likey coordinates of vertices. zsfloat or 1D array-likez coordinates of vertices; either one for all points or one for each point. zdir{'x', 'y', 'z'}, default: 'z'When plotting 2D data, the direction to use as z ('x', 'y' or 'z'). **kwargsOther arguments are forwarded to Plot 2D or 3D data. Parameters: xs1D array-likex coordinates of vertices. ys1D array-likey coordinates of vertices. zsfloat or 1D array-likez coordinates of vertices; either one for all points or one for each point. zdir{'x', 'y', 'z'}, default: 'z'When plotting 2D data, the direction to use as z ('x', 'y' or 'z'). **kwargsOther arguments are forwarded to Create a surface plot. By default it will be colored in shades of a solid color, but it also supports colormapping by supplying the cmap argument. Note The rcount and ccount kwargs, which both default to 50, determine the maximum number of samples used in each direction. If the input data is larger, it will be downsampled (by slicing) to these numbers of points. Note To maximize rendering speed consider setting rstride and cstride to divisors of the number of rows minus 1 and columns minus 1 respectively. For example, given 51 rows rstride can be any of the divisors of 50. Similarly, a setting of rstride and cstride equal to 1 (or rcount and ccount equal the number of rows and columns) can use the optimized path. Parameters:X, Y, Z2D arraysData values. rcount, ccountintMaximum number of samples used in each direction. If the input data is larger, it will be downsampled (by slicing) to these numbers of points. Defaults to 50. rstride, cstrideintDownsampling stride in each direction. These arguments are mutually exclusive with rcount and ccount. If only one of rstride or cstride is set, the other defaults to 10. 'classic'
mode uses a default of Color of the surface patches. cmapColormapColormap of the surface patches. facecolorsarray-like of colors.Colors of each individual patch. normNormalizeNormalization for the colormap. vmin, vmaxfloatBounds for the normalization. shadebool, default: TrueWhether to shade the facecolors. Shading is always disabled when cmap is specified. lightsourceLightSource The lightsource to use when shade is True. **kwargsOther arguments are forwarded to Plot a triangulated surface. The (optional) triangulation can be specified in one of two ways; either: plot_trisurf(triangulation, ...) where triangulation is a plot_trisurf(X, Y, ...) plot_trisurf(X, Y, triangles, ...) plot_trisurf(X, Y, triangles=triangles, ...) in which case a Triangulation object will be created. See
The remaining arguments are: where Z is the array of values to contour, one per point in the triangulation. Parameters:X, Y, Zarray-likeData values as 1D arrays. colorColor of the surface patches. cmapA colormap for the surface patches. normNormalizeAn instance of Normalize to map values to colors. vmin, vmaxfloat, default: NoneMinimum and maximum value to map. shadebool, default: TrueWhether to shade the facecolors. Shading is always disabled when cmap is specified. lightsourceLightSource The lightsource to use when shade is True. **kwargsAll other arguments are passed on to
Examples (Source code, png) (Source code, png) plot_wireframe(X, Y, Z, **kwargs)[source]#Plot a 3D wireframe. Note The rcount and ccount kwargs, which both default to 50, determine the maximum number of samples used in each direction. If the input data is larger, it will be downsampled (by slicing) to these numbers of points. Parameters:X, Y, Z2D arraysData values. rcount, ccountintMaximum number of samples used in each direction. If the input data is larger, it will be downsampled (by slicing) to these numbers of points. Setting a count to zero causes the data to be not sampled in the corresponding direction, producing a 3D line plot rather than a wireframe plot. Defaults to 50. rstride, cstrideintDownsampling stride in each direction. These arguments are mutually exclusive with rcount and ccount. If only one of rstride or cstride is set, the other defaults to 1. Setting a stride to zero causes the data to be not sampled in the corresponding direction, producing a 3D line plot rather than a wireframe plot. 'classic' mode uses a default of Other arguments are forwarded to
Plot a 3D field of arrows. The arguments could be array-like or scalars, so long as they they can be broadcast together. The arguments can also be masked arrays. If an element in any of argument is masked, then that corresponding quiver element will not be plotted. Parameters:X, Y, Zarray-likeThe x, y and z coordinates of the arrow locations (default is tail of arrow; see pivot kwarg). U, V, Warray-likeThe x, y and z components of the arrow vectors. lengthfloat, default: 1The length of each quiver. arrow_length_ratiofloat, default: 0.3The ratio of the arrow head with respect to the quiver. pivot{'tail', 'middle', 'tip'}, default: 'tail'The part of the arrow that is at the grid point; the arrow rotates about this point, hence the name pivot. normalizebool, default: FalseWhether all arrows are normalized to have the same length, or keep the lengths defined by u, v, and w. dataindexable object, optionalIf given, all parameters also accept a string Any additional keyword arguments are delegated to Plot a 3D field of arrows. The arguments could be array-like or scalars, so long as they they can be broadcast together. The arguments can also be masked arrays. If an element in any of argument is masked, then that corresponding quiver element will not be plotted. Parameters:X, Y, Zarray-likeThe x, y and z coordinates of the arrow locations (default is tail of arrow; see pivot kwarg). U, V, Warray-likeThe x, y and z components of the arrow vectors. lengthfloat, default: 1The length of each quiver. arrow_length_ratiofloat, default: 0.3The ratio of the arrow head with respect to the quiver. pivot{'tail', 'middle', 'tip'}, default: 'tail'The part of the arrow that is at the grid point; the arrow rotates about this point, hence the name pivot. normalizebool, default: FalseWhether all arrows are normalized to have the same length, or keep the lengths defined by u, v, and w. dataindexable object, optionalIf given, all parameters also accept a string Any additional keyword arguments are delegated to Create a scatter plot. Parameters: xs, ysarray-likeThe data positions. zsfloat or array-like, default: 0The z-positions. Either an array of the same length as xs and ys or a single value to place all points in the same plane. zdir{'x', 'y', 'z', '-x', '-y', '-z'}, default: 'z'The axis direction for the zs. This is useful when plotting 2D data on a 3D Axes. The data must be passed as xs, ys. Setting zdir to 'y' then plots the data to the x-z-plane. See also Plot 2D data on 3D plot. sfloat or array-like, default: 20The marker size in points**2. Either an array of the same length as xs and ys or a single value to make all markers the same size. ccolor, sequence, or sequence of colors, optionalThe marker color. Possible values:
For more details see the c argument of
Whether to shade the scatter markers to give the appearance of depth. Each call to If given, the
following parameters also accept a string xs, ys, zs, s, edgecolors, c, facecolor, facecolors, color **kwargsAll other arguments are passed on to
PathCollection scatter3D(xs, ys, zs=0, zdir='z', s=20,
c=None, depthshade=True, *args, data=None,
**kwargs)[source]#Create a scatter plot. Parameters: xs, ysarray-likeThe data positions. zsfloat or array-like, default: 0The z-positions. Either an array of the same length as xs and ys or a single value to place all points in the same plane. zdir{'x', 'y', 'z', '-x', '-y', '-z'}, default: 'z'The axis direction for the zs. This is useful when plotting 2D data on a 3D Axes. The data must be passed as xs, ys. Setting zdir to 'y' then plots the data to the x-z-plane. See also Plot 2D data on 3D plot. sfloat or array-like, default: 20The marker size in points**2. Either an array of the same length as xs and ys or a single value to make all markers the same size. ccolor, sequence, or sequence of colors, optionalThe marker color. Possible values:
For more details see the c argument of
Whether to shade the scatter markers to give the appearance of depth. Each call to If given, the
following parameters also accept a string xs, ys, zs, s, edgecolors, c, facecolor, facecolors, color **kwargsAll other arguments are passed on to
PathCollection set(*, adjustable=<UNSET>, agg_filter=<UNSET>, alpha=<UNSET>, anchor=<UNSET>, animated=<UNSET>, aspect=<UNSET>,
autoscale_on=<UNSET>, autoscalex_on=<UNSET>, autoscaley_on=<UNSET>, autoscalez_on=<UNSET>, axes_locator=<UNSET>, axisbelow=<UNSET>, box_aspect=<UNSET>, clip_box=<UNSET>,
clip_on=<UNSET>, clip_path=<UNSET>, facecolor=<UNSET>, frame_on=<UNSET>, gid=<UNSET>, in_layout=<UNSET>, label=<UNSET>, mouseover=<UNSET>, navigate=<UNSET>,
path_effects=<UNSET>, picker=<UNSET>, position=<UNSET>, proj_type=<UNSET>, prop_cycle=<UNSET>, rasterization_zorder=<UNSET>, rasterized=<UNSET>, sketch_params=<UNSET>,
snap=<UNSET>, title=<UNSET>, transform=<UNSET>, url=<UNSET>, visible=<UNSET>, xbound=<UNSET>, xlabel=<UNSET>, xlim=<UNSET>, xlim3d=<UNSET>,
xmargin=<UNSET>, xscale=<UNSET>, xticklabels=<UNSET>, xticks=<UNSET>, ybound=<UNSET>, ylabel=<UNSET>, ylim=<UNSET>, ylim3d=<UNSET>, ymargin=<UNSET>,
yscale=<UNSET>, yticklabels=<UNSET>, yticks=<UNSET>, zbound=<UNSET>, zlabel=<UNSET>, zlim=<UNSET>, zlim3d=<UNSET>, zmargin=<UNSET>, zorder=<UNSET>,
zscale=<UNSET>, zticklabels=<UNSET>, zticks=<UNSET>)[source]#Set multiple properties at once. Supported properties are set_aspect(aspect, adjustable=None, anchor=None, share=False)[source]# Set the aspect ratios. Parameters:aspect{'auto', 'equal', 'equalxy', 'equalxz', 'equalyz'}Possible values:
Currently ignored by Axes3D If not None, this defines which parameter will be adjusted to meet the required aspect. See If not None, this defines where the Axes will be drawn if there is extra space due to aspect constraints. The most common way to to specify the anchor are abbreviations of cardinal directions:
See If Set whether the zaxis is
autoscaled when drawing or by Turn the x- and y-axis off. This affects the axis lines, ticks, ticklabels, grid and axis labels. set_axis_on()[source]#Turn the x- and y-axis on. This affects the axis lines, ticks, ticklabels, grid and axis labels. set_box_aspect(aspect, *, zoom=1)[source]#Set the Axes box aspect. The box aspect is the ratio of height to width in display units for each face of the box when viewed perpendicular to that face. This is not to be confused with the data aspect (which for Axes3D is always 'auto'). The default ratios are 4:4:3 (x:y:z). To simulate having equal aspect in data space, set the box aspect to match your data range in each dimension. zoom controls the overall size of the Axes3D in the figure. Parameters: aspect3-tuple of floats or NoneChanges the physical dimensions of the Axes3D, such that the ratio of the axis lengths in display units is x:y:z. If None, defaults to (4,4,3). zoomfloat, default: 1Control overall size of the Axes3D in the figure. Must be > 0. set_frame_on(b)[source]#Set whether the 3D axes panels are drawn. Parameters:bbool set_proj_type(proj_type, focal_length=None)[source]#Set the projection type. Parameters:proj_type{'persp', 'ortho'}The projection type. focal_lengthfloat, default: NoneFor a projection type of 'persp', the focal length of the virtual camera. Must be > 0. If None, defaults to 1. The focal length can be computed from a desired Field Of View via the equation: focal_length = 1/tan(FOV/2) set_title(label, fontdict=None, loc='center', **kwargs)[source]#Set a title for the Axes. Set one of the three available Axes titles. The available titles are positioned above the Axes in the center, flush with the left edge, and flush with the right edge. Parameters:labelstrText to use for the title fontdictdictA dictionary controlling the appearance of the title text, the default fontdict is: {'fontsize': rcParams['axes.titlesize'], 'fontweight': rcParams['axes.titleweight'], 'color': rcParams['axes.titlecolor'], 'verticalalignment': 'baseline', 'horizontalalignment': loc}loc{'center', 'left', 'right'}, default: rcParams["axes.titlelocation"] (default: 'center' )Which title to set. yfloat, default:rcParams["axes.titley"] (default: None )Vertical Axes location for the title (1.0 is the top). If None (the default) and rcParams["axes.titlepad"] (default: 6.0 )The offset of the title from the top of the Axes, in points. Returns:Text The matplotlib text instance representing the title Other Parameters:**kwargsText propertiesOther keyword arguments are text properties, see Set the x-axis view limits. Parameters:leftfloat, optionalThe left xlim in data coordinates. Passing None leaves the limit unchanged. The left and right xlims may also be passed as the tuple (left, right) as the first positional argument (or as the left keyword argument). rightfloat, optionalThe right xlim in data coordinates. Passing None leaves the limit unchanged. emitbool, default: TrueWhether to notify observers of limit change. autobool or None, default: FalseWhether to turn on autoscaling of the x-axis. True turns on, False turns off, None leaves unchanged. xmin, xmaxfloat, optionalThey are equivalent to left and right respectively, and it is an error to pass both xmin and left or xmax and right. Returns:left, right(float, float)The new x-axis limits in data coordinates. See also get_xlim set_xbound , get_xbound invert_xaxis , xaxis_inverted Notes The left value may be greater than the right value, in which case the x-axis values will decrease from left to right. Examples >>> set_xlim(left, right) >>> set_xlim((left, right)) >>> left, right = set_xlim(left, right) One limit may be left unchanged. >>> set_xlim(right=right_lim) Limits may be passed in reverse order to flip the direction of the x-axis. For example, suppose x represents the number of years before present. The x-axis limits might be set like the following so 5000 years ago is on the left of the plot and the present is on the right. set_xscale(value, **kwargs)[source]#Set the x-axis scale. Parameters: value{"linear"}The axis scale type to apply. 3D axes currently only support linear scales; other scales yield nonsensical results. **kwargsKeyword arguments are nominally forwarded to the scale class, but none of them is applicable for linear scales. set_ylim3d(bottom=None, top=None, *, emit=True, auto=False, ymin=None, ymax=None)[source]#Set the y-axis view limits. Parameters:bottomfloat, optionalThe bottom ylim in data coordinates. Passing None leaves the limit unchanged. The bottom and top ylims may also be passed as the tuple (bottom, top) as the first positional argument (or as the bottom keyword argument). topfloat, optionalThe top ylim in data coordinates. Passing None leaves the limit unchanged. emitbool, default: TrueWhether to notify observers of limit change. autobool or None, default: FalseWhether to turn on autoscaling of the y-axis. True turns on, False turns off, None leaves unchanged. ymin, ymaxfloat, optionalThey are equivalent to bottom and top respectively, and it is an error to pass both ymin and bottom or ymax and top. Returns:bottom, top(float, float)The new y-axis limits in data coordinates. See also get_ylim set_ybound , get_ybound invert_yaxis , yaxis_inverted Notes The bottom value may be greater than the top value, in which case the y-axis values will decrease from bottom to top. Examples >>> set_ylim(bottom, top) >>> set_ylim((bottom, top)) >>> bottom, top = set_ylim(bottom, top) One limit may be left unchanged. >>> set_ylim(top=top_lim) Limits may be passed in reverse order to flip the direction of the y-axis. For example, suppose Set the y-axis scale. Parameters:value{"linear"}The axis scale type to apply. 3D axes currently only support linear scales; other scales yield nonsensical results. **kwargsKeyword arguments are nominally forwarded to the scale class, but none of them is applicable for linear scales. set_zbound(lower=None, upper=None)[source]#Set the lower and upper numerical bounds of the z-axis. This method will honor axes inversion regardless of parameter order. It will not change the autoscaling setting ( Set zlabel. See doc for
Set 3D z limits. See Alias for
Set padding of Z data limits prior to autoscaling. m times the data interval will be added to each end of that interval before it is used in autoscaling. If m is negative, this will clip the data range instead of expanding it. For example, if your data is in the range [0, 2], a margin of 0.1 will result in a range [-0.2, 2.2]; a margin of -0.1 will result in a range of [0.2, 1.8]. Parameters:mfloat greater than -0.5 set_zscale(value, **kwargs)[source]#Set the z-axis scale. Parameters: value{"linear"}The axis scale type to apply. 3D axes currently only support linear scales; other scales yield nonsensical results. **kwargsKeyword arguments are nominally forwarded to the scale class, but none of them is applicable for linear scales. set_zticklabels(labels, *, fontdict=None, minor=False, **kwargs)[source]#Set the zaxis' labels with list of string labels. Warning This method should only be used after fixing the tick positions using The label texts. fontdictdict, optionalA dictionary controlling the appearance of the ticklabels. The default fontdict is: {'fontsize': rcParams['axes.titlesize'], 'fontweight': rcParams['axes.titleweight'], 'verticalalignment': 'baseline', 'horizontalalignment': loc}minorbool, default: False Whether to set the minor ticklabels rather than the major ones. Returns:list ofText The labels. Other Parameters:**kwargsText properties.
set_zticks(ticks, labels=None, *, minor=False,
**kwargs)[source]#Set the zaxis' tick locations and optionally labels. If necessary, the view limits of the Axis are expanded so that all given ticks are visible. Parameters:tickslist of floatsList of tick locations. The axis Some tick formatters will not label arbitrary tick positions; e.g. log formatters only label decade ticks by default. In such a case you can set a formatter explicitly on the axis using
List of tick labels. If not set, the labels are generated with the axis tick
If
Notes The mandatory expansion of the view limits is an intentional design choice to prevent the surprise of a non-visible tick. If you need other limits, you should set the limits explicitly after setting the ticks. sharez(other)[source]#Share the z-axis with other. This is equivalent to passing Create a 3D stem plot. A stem plot draws lines perpendicular to a baseline, and places markers at the heads. By default, the baseline is defined by x and y, and stems are drawn vertically from bottom to z. Parameters:x, y, zarray-likeThe positions of the heads of the stems. The stems are drawn along the orientation-direction from the baseline at bottom (in the orientation-coordinate) to the heads. By default, the x and y positions are used for the baseline and z for the head position, but this can be changed by orientation. linefmtstr, default: 'C0-'A string defining the properties of the vertical lines. Usually, this will be a color or a color and a linestyle:
Note: While it is technically possible to specify valid formats other than color or color and linestyle (e.g. 'rx' or '-.'), this is beyond the intention of the method and will most likely not result in a reasonable plot. markerfmtstr, default: 'C0o'A string defining the properties of the markers at the stem heads. basefmtstr, default: 'C3-'A format string defining the properties of the baseline. bottomfloat, default: 0The position of the baseline, in orientation-coordinates. labelstr, default: NoneThe label to use for the stems in legends. orientation{'x', 'y', 'z'}, default: 'z'The direction along which stems are drawn. dataindexable object, optionalIf given, all parameters also accept a string StemContainer The container may be treated like a tuple (markerline, stemlines, baseline) Examples (Source code, png) (png) (png) stem3D(x, y, z, *, linefmt='C0-', markerfmt='C0o', basefmt='C3-', bottom=0, label=None, orientation='z', data=None)[source]#Create a 3D stem plot. A stem plot draws lines perpendicular to a baseline, and places markers at the heads. By default, the baseline is defined by x and y, and stems are drawn vertically from bottom to z. Parameters:x, y, zarray-likeThe positions of the heads of the stems. The stems are drawn along the orientation-direction from the baseline at bottom (in the orientation-coordinate) to the heads. By default, the x and y positions are used for the baseline and z for the head position, but this can be changed by orientation. linefmtstr, default: 'C0-'A string defining the properties of the vertical lines. Usually, this will be a color or a color and a linestyle:
Note: While it is technically possible to specify valid formats other than color or color and linestyle (e.g. 'rx' or '-.'), this is beyond the intention of the method and will most likely not result in a reasonable plot. markerfmtstr, default: 'C0o'A string defining the properties of the markers at the stem heads. basefmtstr, default: 'C3-'A format string defining the properties of the baseline. bottomfloat, default: 0The position of the baseline, in orientation-coordinates. labelstr, default: NoneThe label to use for the stems in legends. orientation{'x', 'y', 'z'}, default: 'z'The direction along which stems are drawn. dataindexable object, optionalIf given, all parameters also accept a string StemContainer The container may be treated like a tuple (markerline, stemlines, baseline) Examples (Source code, png) (png) (png) text(x, y, z, s, zdir=None, **kwargs)[source]#Add text to the plot. kwargs will be passed on to Axes.text, except for the zdir keyword, which sets the direction to be used as the z direction. text2D(x, y, s, fontdict=None, **kwargs)[source]#Add text to the Axes. Add the text s to the Axes at location x, y in data coordinates. Parameters:x, yfloatThe position to place the text. By default, this is in data coordinates. The coordinate system can be changed using the transform parameter. sstrThe text. fontdictdict, default: NoneA dictionary to override the
default text properties. If fontdict is None, the defaults are determined by Text The created
Text properties.Other miscellaneous text parameters.
Examples Individual keyword arguments can be used to override any given parameter: >>> text(x, y, s, fontsize=12) The default transform specifies that text is in data coords, alternatively, you can specify text in axis coords ((0, 0) is lower-left and (1, 1) is upper-right). The example below places text in the center of the Axes: >>> text(0.5, 0.5, 'matplotlib', horizontalalignment='center', ... verticalalignment='center', transform=ax.transAxes) You can put a rectangular box around the text instance (e.g., to set a background color) by
using the keyword bbox. bbox is a dictionary of >>> text(x, y, s, bbox=dict(facecolor='red', alpha=0.5))text3D(x, y, z, s, zdir=None, **kwargs)[source]# Add text to the plot. kwargs will be passed on to Axes.text, except for the zdir keyword, which sets the direction to be used as the z direction. tick_params(axis='both', **kwargs)[source]#Convenience method for changing the appearance of ticks and tick labels. See Also, because of how Axes3D objects are drawn very differently from regular 2D axes, some of these settings may have ambiguous meaning. For simplicity, the 'z' axis will accept settings as if it was like the 'y' axis. Note Axes3D currently ignores some of these settings. tricontour(*args, extend3d=False, stride=5, zdir='z', offset=None, data=None, **kwargs)[source]#Create a 3D contour plot. Note This method currently produces incorrect output due to a longstanding bug in 3D PolyCollection rendering. Parameters:X, Y, Zarray-likeInput data. See Whether to extend contour in 3D. strideintStep size for extending contour. zdir{'x', 'y', 'z'}, default: 'z'The direction to use. offsetfloat, optionalIf specified, plot a projection of the contour lines at this position in a plane normal to zdir. dataindexable object, optionalIf given, all parameters also accept a string Other arguments are forwarded to Create a 3D filled contour plot. Note This method currently produces incorrect output due to a longstanding bug in 3D PolyCollection rendering. Parameters:X, Y, Zarray-likeInput data. See
The direction to use. offsetfloat, optionalIf specified, plot a projection of the contour lines at this position in a plane normal to zdir. dataindexable object, optionalIf given, all parameters also accept a string Other arguments are forwarded to Extend the If no data is set currently, the Bbox will ignore its limits and set the bound to be the bounds of the xydata (xys). Otherwise, it will compute the bounds of the union of its current data and the data in xys. Parameters:xys2D array-likeThe points to include in the data limits Bbox. This can be either a list of (x, y) tuples or a Nx2 array. updatex, updateybool, default: TrueWhether to update the x/y limits. view_init(elev=None, azim=None, roll=None, vertical_axis='z')[source]#Set the elevation and azimuth of the axes in degrees (not radians). This can be used to rotate the axes programmatically. To look normal to the primary planes, the following elevation and azimuth angles can be used. A roll angle of 0, 90, 180, or 270 deg will rotate these views while keeping the axes at right angles.
The elevation angle in degrees rotates the camera above the plane pierced by the vertical axis, with a positive angle corresponding to a location above that plane. For example, with the default vertical axis of 'z', the elevation defines the angle of the camera location above the x-y plane. If None, then the initial value as specified in the
The azimuthal angle in degrees rotates the camera about the vertical axis, with a positive angle corresponding to a right-handed rotation. For example, with the default vertical axis of 'z', a positive
azimuth rotates the camera about the origin from its location along the +x axis towards the +y axis. If None, then the initial value as specified in the The roll angle in degrees rotates the camera
about the viewing axis. A positive angle spins the camera clockwise, causing the scene to rotate counter-clockwise. If None, then the initial value as specified in the The axis to align vertically. azim rotates about this axis. voxels([x, y, z, ]/, filled, facecolors=None, edgecolors=None, **kwargs)[source]#Plot a set of filled voxels All voxels are plotted as 1x1x1 cubes on the axis, with A 3D array of values, with truthy values indicating which voxels to fill x, y, z3D np.array, optionalThe coordinates of the corners of the voxels. This should broadcast to a shape one larger in every dimension than the shape of filled. These can be used to plot non-cubic voxels. If not specified, defaults to increasing integers along each axis, like those returned by The color to draw the faces and edges of the voxels. Can only be passed as keyword arguments. These parameters can be:
Whether to shade the facecolors. Shading is always disabled when cmap is specified. lightsourceLightSource The lightsource to use when shade is True. **kwargsAdditional keyword arguments to pass onto A dictionary indexed by coordinate, where Examples (Source code, png) (Source code, png) (Source code, png) (Source code, png) propertyw_xaxis[source]# propertyw_yaxis[source]# propertyw_zaxis[source]# zaxis_date(tz=None)[source]#Set up axis ticks and labels to treat data along the zaxis as dates. Parameters:tzstr ordatetime.tzinfo , default: rcParams["timezone"] (default: 'UTC' )The timezone used to create date labels. Notes This function is merely provided for completeness, but 3D axes do not support dates for ticks, and so this may not work as expected. zaxis_inverted()[source]#Returns True if the z-axis is inverted. How do you plot a 3D axis in Python?Plot a single point in a 3D space. Step 1: Import the libraries. import matplotlib.pyplot as plt from mpl_toolkits.mplot3d import Axes3D. ... . Step 2: Create figure and axes. fig = plt.figure(figsize=(4,4)) ax = fig.add_subplot(111, projection='3d') ... . Step 3: Plot the point.. How do you show the axis in Python?MatPlotLib with Python. Create the points x, y1 and y2 using numpy.. Plot the sine and cosine curves using plot() methods.. Plot the vertical line, i.e., x=0.. Plot the horizontal line, i.e., y=0.. Intersection point of (Step 3 and 4), could be the origin.. To display the label of lines, use legend() method.. What does PLT axis () do?The plt. axis() method allows you to set the x and y limits with a single call, by passing a list which specifies [xmin, xmax, ymin, ymax] : In [11]: plt.
Why is %Matplotlib inline?Why matplotlib inline is used. You can use the magic function %matplotlib inline to enable the inline plotting, where the plots/graphs will be displayed just below the cell where your plotting commands are written. It provides interactivity with the backend in the frontends like the jupyter notebook.
|