Python中的3D图

use*_*350 1 python 3d plot matplotlib

我如何在3个维度中绘制以下数据?(显然,还有更多!)

data = [[10, 10, 0.84496124031007758],
        [10, 20, 0.87209302325581395],
        [10, 30, 0.88139534883720927],
        [20, 10, 0.86201550387596892],
        [20, 20, 0.87441860465116272],
        [20, 30, 0.88992248062015500],
        [30, 10, 0.87984496124031009],
        [30, 20, 0.89922480620155043],
        [30, 30, 0.92015503875968996]]
Run Code Online (Sandbox Code Playgroud)

Gar*_*689 5

你想要得到什么样的情节?试试这个散点图.我还假设您的数据列x,y,z在您问题的列表中.

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

x, y, z = zip(*data)

fig = plt.figure()
ax = fig.add_subplot(111, projection='3d')
ax.scatter(x,y,z)
plt.show()
Run Code Online (Sandbox Code Playgroud)