4

ここに画像の説明を入力

matplotlib を使用してこのグラフを作成することができました。B という名前の軸から 0.2、0.4、0.6.. を削除し、A という名前の軸で軸間隔を 200 から 100 に変更したいと思います。 ?

ここに私が書いたコードがあります。

from mpl_toolkits.mplot3d import Axes3D
import numpy as np
import matplotlib
import matplotlib.pyplot as plt
f_attributes=open("continuous.data","r")
x=[]
y=[]
spam=[]
count=1
skew=[]
fig = plt.figure()
ax = Axes3D(fig)
total=[]
while count<=1024:

attributes=f_attributes.readline()
attributes=attributes.replace(".\n","") 
attributes=attributes.split(',')
classification=int(attributes[10].replace(".\n",""))
if float(attributes[8]) >=0:

    skew.append(float(attributes[8]))
    x.append(count)
    y.append(classification)


    if classification == 0:
        ax.scatter(x, y, skew, c='g', marker='o')

    else:
        ax.scatter(x, y, skew, c='r', marker='o')

    x=[]
    y=[]
    skew=[]
count+=1


ax.set_xlabel('A')
ax.set_ylabel('B')
ax.set_zlabel('C')
plt.show()

関係のない詳細は無視してください..

4

1 に答える 1

3

これは実際にはそれほど簡単ではありません。オブジェクトを掘り下げる必要があります。Axes3D は Axes に基づいているため、このset_yticklabelsメソッドを使用できると最初に想定しましたが、明らかにそれは機能しません。コードを見ると、y 軸が axis3d.YAxis である w_yaxis を介して設定されていることがわかります。これは、最終的にset_ticklabelsメソッドを持つ axis.Axis に基づいており、これは機能しました。

ax.w_yaxis.set_ticklabels([])

「Aという名前の軸で軸間隔を200から100に変更する」とはどういう意味ですか?

于 2011-09-25T09:39:51.947 に答える