Bonjour,
Je souhaite créer un graphe 3d à partir de trois listes de données.
voici ce que j'ai fait..
Par contre, j'ai toujours un message d'erreur à propos de la deuxieme ligne ...
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20 fig = plt.figure() ax = fig.add_subplot(111, projection='3d') xi = np.linspace(min(x), max(x)) yi = np.linspace(min(y), max(y)) X, Y = np.meshgrid(xi, yi) Z = griddata(x, y, z, xi, yi) surf = ax.plot_surface(X, Y, Z, rstride=6, cstride=6, cmap=cm.jet, linewidth=0) ax.set_zlim3d(min(z), max(z)) ax.w_zaxis.set_major_locator(LinearLocator(10)) ax.w_zaxis.set_major_formatter(FormatStrFormatter('%.03f')) fig.colorbar(surf, shrink=0.5, aspect=5) plt.show()Je ne sais pas comment faire pour résoudre ce probleme
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8 >>> ax = fig.add_subplot(111, projection='3d') Traceback (most recent call last): File "<stdin>", line 1, in <module> File "/usr/lib/pymodules/python2.6/matplotlib/figure.py", line 677, in add_subplot projection_class = get_projection_class(projection) File "/usr/lib/pymodules/python2.6/matplotlib/projections/__init__.py", line 61, in get_projection_class raise ValueError("Unknown projection '%s'" % projection) ValueError: Unknown projection '3d'
merci d avance pour votre aide
Partager