2016-04-27 19 views
0

Ich habe es geschafft, ein 3D-Diagramm mit Spyder (Python 3.5) zu plotten. Die Größe des Diagramms ist jedoch zu klein. Wie vergrößere ich die Größe des Diagramms, damit ich es als Bilddatei speichern kann?Größe 3D-Streudiagramm ändern

Die unten ist der Code verwendet, um die Grafik zu zeichnen:

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



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

x =[0,1,2,3,4] 
y =[11,1,5,2,9] 
z =[1,2,3,4,5,6] 



ax.scatter(x, y, z, c='r', marker='o') 

ax.set_xlabel('Days since last interaction') 
ax.set_ylabel('Number of conversions') 
ax.set_zlabel('Total number of interactions') 

plt.show() 

Dank!

Antwort

0

können Sie das benannte Argument figsize wenn Ihre Figur

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

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

x =[0, 1, 2, 3, 4, 0] 
y =[11, 1, 5, 2, 9, 0] 
z =[1, 2, 3, 4, 5, 6] # this array contained one value too many. (I padded the other two arrays) 

ax.scatter(x, y, z, c='r', marker='o') 

ax.set_xlabel('Days since last interaction') 
ax.set_ylabel('Number of conversions') 
ax.set_zlabel('Total number of interactions') 

plt.show() 
+0

Das funktionierte. Vielen Dank für Ihre Hilfe Reblochon! – Max