简体   繁体   中英

How to zoom on an interactive 3D plot in jupyter notebook

I'm creating a 3D scatter plot using matplotlib and would like to interact with it in jupyter notebook by panning and zooming. However, when I try to use the zoom button on the interactive plot, it acts the same way as the pan button. Is there a way to zoom on interactive 3D plots in jupyter notebook? Here's a MWE that reproduces the issue for me:

import matplotlib.pyplot as plt
import numpy as np
%matplotlib notebook

np.random.seed(1000)

fig = plt.figure()
ax = fig.add_subplot(111, projection='3d')

N = 100

ax.scatter(np.random.rand(N), np.random.rand(N), np.random.rand(N), '.')

The pan and zoom buttons in matplotlib 3D plots do not work at the moment, but should hopefully be enabled in matplotlib version 3.7 (if this PR gets merged in). In the meantime, if you are using a mouse you should be able to rotate 3D plots with the left mouse button, pan using the middle mouse button, and zoom using the right mouse button.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM