Free tools Windows power users keep installed
One-click scans. No signup required.
For a repeatable close-up, set narrower x, y and z axis limits with set_xlim(), set_ylim() and set_zlim(). To explore a plot by hand, right-click and drag vertically in an interactive backend. If you want to see the data from another direction, change the camera with view_init() instead; that changes the angle, not the data range.
Set a reproducible close-up with axis limits
Axis limits define the data-coordinate ranges visible along each axis. Narrowing them shows a smaller region of the existing plot; it does not change the underlying data values.
import matplotlib.pyplot as plt
fig = plt.figure()
ax = fig.add_subplot(projection="3d")
ax.scatter(xs, ys, zs)
# Replace these bounds with the region you want to inspect.
ax.set_xlim(xmin, xmax)
ax.set_ylim(ymin, ymax)
ax.set_zlim(zmin, zmax)
plt.show()
The official 3D scatter example uses this figure-and-axes setup and calls ax.scatter(xs, ys, zs). Choose limits based on your own data rather than copying example ranges.
Each limit method accepts a lower and upper bound. For example, ax.set_xlim((xmin, xmax)) sets both x bounds; you can also set one bound while leaving the other unchanged. Passing bounds in reverse order reverses that axis’s direction. The same patterns apply to y and z. See the APIs for x limits, y limits and z limits.
Do these 3 things before closing this tab:
1Scan for outdated or missing drivers - takes under a minute2Clear out junk files and repair common Windows errors3Fix the driver behind crashes, sound loss and screen glitches#1 Best Overall
Zoom interactively with the mouse
In an interactive Matplotlib backend, right-click and drag vertically to zoom the 3D scene. The documented default gestures are left-drag to rotate, middle-drag to pan and right-drag to zoom. These controls belong to mplot3d scene interaction; the 2D toolbar’s pan and zoom buttons are not the controls for manipulating the 3D scene.
Mouse interaction depends on an interactive backend. A static rendered image will not respond to dragging. Matplotlib documents the default mouse-button assignments in the mouse_init API, which also allows the buttons to be configured.
Rank #2
Change the viewing angle, not the zoom range
If points overlap or hide one another, rotate the camera to inspect the scatter plot from another direction. Use ax.view_init(elev=..., azim=..., roll=...), with angles in degrees, or rotate by dragging in an interactive figure. These controls change camera orientation; they do not select a narrower data-coordinate range. The view_init API documents the angle parameters.
The current stable Matplotlib view-angle guide identifies its documentation as version 3.11.2 and describes arcball as the default mouse-rotation style. It notes that before Matplotlib 3.10, mouse position corresponded directly to azimuth and elevation, so rotation behavior can differ in older releases. See the mplot3d view-angle guide.
Choose the control that matches your goal
| Goal | Control | What it changes |
|---|---|---|
| Show a known subset or range of values | set_xlim(), set_ylim(), set_zlim() |
Visible axis bounds in data coordinates |
| Explore the scene by hand | Right-drag vertically in an interactive backend | Interactive zoom of the 3D scene |
| Reduce overlap or see another side | view_init() or mouse rotation |
Camera orientation |
| Change apparent axis proportions or projection | set_box_aspect() or projection settings |
Display geometry and projection |
Matplotlib renders a 3D scene as a 2D projection. Box aspect and projection choices affect how the axes appear on screen; they are presentation controls, not substitutes for setting the data region you want to inspect. The mplot3d overview describes these capabilities and notes that 3D plotting in Matplotlib is less mature than its 2D plotting.
Independent reader supportYour contribution helps us test, update, and keep practical guides available for everyone.Understand what limits do to plotted objects
Setting axis limits controls the visible range, but clipping behavior for complete 3D objects is a separate concern. In the current axis-limit clipping example, axlim_clip defaults to False. When set to True, a line segment with a vertex outside the view limits is hidden as a whole; the example describes the same behavior for 3D patches. This option is not required for an ordinary close-up of a scatter plot.
Quick Recap
Best Value
Product prices and availability are accurate as of the date/time indicated and are subject to change. Any price and availability information displayed on Amazon at the time of purchase will apply.




