python绘制可多角度查看的3d图像

用鼠标拖动可多角度查看3d图像。

# Enable interactive rotation of graph
%matplotlib notebook

import numpy as np
import matplotlib.pyplot as plt
from mpl_toolkits.mplot3d import Axes3D

def plot3d(x, y, z=None, color='r', m='o', figsize=(4,4)):   
    fig = plt.figure(figsize=figsize)
    ax = fig.add_subplot(1, 1, 1, projection='3d')
    ax.scatter(x, y, z, c=color, marker=m)
    ax.set_xlabel('x')
    ax.set_ylabel('y')
    ax.set_zlabel('z')
    plt.show()

猜你喜欢

转载自blog.csdn.net/qq_40136685/article/details/107723154