4
은 어떻게하기 matplotlib를 사용하여이 그래프를 만들 관리해야하기 matplotlib
의 3 차원 축 설정을 변경합니다. 나는 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()
무시하십시오 관련이없는 사항 ..
헤이 잘 작동합니다. 감사합니다! .. 혼란을 가져 미안합니다 ... 질문의 두 번째 부분 ... "A"라고 표시된 축은 200,400,600 ... 100, 100,200,300 ... 1000 – user926321
이 경우 x 데이터를 변경하는 것이 가장 쉽지 않은가요? – steabert
흠 .. 실제로는 아니지만, 정말로하고 싶은 것입니다. 'B'라고 표시된 축의 길이를 줄이려고합니다. 현재 값은 [0,1]이고, 현재 간격은 0입니다. , 0.2,0.4,0.6 ..., 1 0, 0.5, 1로 바꾸고 싶습니다. 축 'B'의 길이가 줄어 듭니다. – user926321