Driver FixRecommendedSound, Wi-Fi or graphics acting up? Check drivers firstFind missing or outdated drivers fast.Check DriversOctober DealsAmazon USOctober deal check: compare before you payAmazon US: current deals, useful picks and tech finds.Check DealsWindows FixRecommendedWindows errors stealing your time? Find the fix fastScan stability, cleanup and performance issues.Fix Now×
Skip to content
World desk2 min

How to Change the View Angle of a Matplotlib 3D Scatter Plot

Use ax.view_init(elev=..., azim=..., roll=...) to adjust a Matplotlib 3D scatter plot's camera in degrees, with reference settings for top and side views.
Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Call ax.view_init(elev=..., azim=..., roll=...) on the 3D axes to change the camera view. The angles are in degrees: elevation tilts the camera up or down, azimuth moves it around the plot, and roll spins the view around the viewing direction.

Set the view angle in Python

Create a 3D axes, draw the scatter plot on that axes, then set its view with view_init before displaying or saving the figure:

As an Amazon Associate I earn from qualifying purchases.

import matplotlib.pyplot as plt

fig = plt.figure()
ax = fig.add_subplot(projection="3d")
ax.scatter(x, y, z)
ax.view_init(elev=25, azim=45)
plt.show()

Here, x, y, and z are your data arrays or sequences. The call affects the specific axes object ax; use the same object for both scatter and view_init. Matplotlib’s Axes3D.view_init API documents the available angles and their behavior.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

What elevation, azimuth, and roll control

  • Elevation (elev): Raises or lowers the camera relative to the horizontal plane. With the default z-axis vertical, a positive elevation looks down from above the x-y plane.
  • Azimuth (azim): Moves the camera around the vertical axis. With the default z-axis vertical, positive azimuth rotates from the camera’s +x direction toward +y.
  • Roll (roll): Spins the camera around its viewing direction. Positive roll turns the camera clockwise, making the scene appear to rotate counter-clockwise. It is optional for ordinary view adjustments.

Supply angles in degrees, not radians. You can omit an argument when you want to retain its initially specified value. For example, ax.view_init(elev=25, azim=45) leaves roll at its existing setting. The view-angle guide explains the camera controls and interactive rotation.

Use reference angles for top and side views

For the default z-vertical axes, the Matplotlib 3.10.9 API reference lists these settings for views aligned with the main coordinate planes:

View Elevation Azimuth
XY plane (top) 90° −90°
XZ plane (side) 0° −90°
YZ plane (side) 0° 0°

These reference settings come from the Matplotlib 3.10.9 view_init API reference. They are useful starting points when you need to inspect a projection onto a particular coordinate plane.

Choose an angle that reveals the data

There is no universally best camera position. Change elevation and azimuth in small increments and inspect whether the view separates overlapping points, clarifies a planar relationship, or makes depth easier to judge. For example, Matplotlib’s 3D scatter plot example uses ax.view_init(elev=20., azim=-35, roll=0) to make it easier to see that the points lie on the plane y=0. Treat those values as an illustration for that plot, not a general best setting.

Free tools Windows power users keep installed

One-click scans. No signup required.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Rotate the plot interactively

You can also drag a 3D axes with the mouse while exploring a figure. The current stable view-angle guide documents arcball as the default mouse-rotation style and allows changing it through rcParams["axes3d.mouserotationstyle"]. Mouse behavior changed in Matplotlib 3.10: before 3.10, mouse position mapped directly to azimuth and elevation; newer trackball-style behavior can also involve roll. For reproducible figures, record the final angles and set them explicitly with view_init.

Independent reader supportYour contribution helps us test, update, and keep practical guides available for everyone.Support on Ko-Fi

Use 3D axes methods for 3D content

Matplotlib’s mplot3d toolkit presents a 3D scene through a 2D projection. Create the 3D axes with fig.add_subplot(projection="3d"), then use its methods such as ax.scatter and ax.view_init. The mplot3d overview notes that pyplot functions for adding plot content are strictly 2D; the explicit 3D axes methods are the controls for a 3D scatter plot.

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.

Leave a Reply

Your email address will not be published. Required fields are marked *

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

More from the Wire

  1. World desk4 min
    How to Spot an AI Voice Scam Before Sending MoneyDon’t rely on how a caller sounds. Pause, call back through a known number, and verify the emergency with another trusted person before sending money.
  2. Mountain View desk4 min
    Google’s SynthID Detector: How to Check AI-Generated Images, Video and AudioGoogle’s SynthID Detector looks for an embedded watermark in supported images, video and audio. Here is what its results do—and do not—show.
  3. Redmond desk20 min
    How to create a link to File or Folder in Windows 11Windows 11 gives you several ways to point to a file or folder without moving or duplicating it. You can create a desktop shortcut,…
Recommended PC Tool
Recommended PC Tool
Windows Errors? Fix Them Before They SpreadFree repair scan
Outdated Drivers Are Slowing You DownFree scan - exact matches

Two free Windows tools

One Free Minute Could Fix That PC

Before you go - each of these free tools takes about a minute and tackles what quietly slows a Windows PC down.

Special offer. View Outbyte info, uninstall instructions, EULA, and Privacy Policy.