Bird
0
0

What will be the effect of this code snippet on the 3D plot's view?

medium📝 Predict Output Q13 of 15
Matplotlib - 3D Plotting
What will be the effect of this code snippet on the 3D plot's view?
import matplotlib.pyplot as plt
from mpl_toolkits.mplot3d import Axes3D
fig = plt.figure()
ax = fig.add_subplot(111, projection='3d')
ax.view_init(elev=90, azim=0)
plt.show()
AThe plot is viewed from the side at 90 degrees azimuth.
BThe plot is viewed from directly above (top-down view).
CThe plot is viewed from the front with default angles.
DThe plot will raise an error due to invalid angles.
Step-by-Step Solution
Solution:
  1. Step 1: Analyze elev=90 effect

    Elevation of 90 degrees means the camera is directly above the plot looking down.
  2. Step 2: Analyze azim=0 effect

    Azimuth 0 means no horizontal rotation, so the view is straight down from above.
  3. Final Answer:

    The plot is viewed from directly above (top-down view). -> Option B
  4. Quick Check:

    elev=90 means top-down view [OK]
Quick Trick: elev=90 means looking straight down [OK]
Common Mistakes:
  • Thinking azim=0 changes vertical angle
  • Assuming default view instead of top-down
  • Believing this causes an error

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More Matplotlib Quizzes