600字范文,内容丰富有趣,生活中的好帮手!
600字范文 > python的三维坐标轴设置_如何更改matplotlib中的三维轴设置

python的三维坐标轴设置_如何更改matplotlib中的三维轴设置

时间:2023-03-11 10:29:14

相关推荐

python的三维坐标轴设置_如何更改matplotlib中的三维轴设置

我已经成功地使用matplotlib创建了这个图形。我想删除0.2,0.4,0.6。。从名为B的轴,将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()

请忽略不相关的细节。。在

本内容不代表本网观点和政治立场,如有侵犯你的权益请联系我们处理。
网友评论
网友评论仅供其表达个人看法,并不表明网站立场。