1

Spyder (Python 3.5) を使用して 3D グラフをプロットすることができました。ただし、グラフのサイズが小さすぎます。画像ファイルとして保存できるように、グラフのサイズを大きくするにはどうすればよいですか?

以下は、グラフをプロットするために使用されるコードです。

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()

ありがとう!

4

1 に答える 1

2

figsizeフィギュアを作成するときに名前付き引数を使用できます

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()
于 2016-04-27T08:21:57.673 に答える