加入收藏 | 设为首页 | 会员中心 | 我要投稿 安卓应用网 (https://www.0791zz.com/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 编程开发 > Python > 正文

轴不在情节上

发布时间:2020-05-24 22:16:28 所属栏目:Python 来源:互联网
导读:我一直在尝试使用坐标显示区域.当我将坐标直接输入到列表中时,它将显示该区域.但是,当我使用变量时,它没有.#plotting a triangle using coordinates print(Enter the coordinates) Na = input(Northings of A = ) Ea = input(Eastings of A

我一直在尝试使用坐标显示区域.
当我将坐标直接输入到列表中时,它将显示该区域.
但是,当我使用变量时,它没有.

#plotting a triangle using coordinates
print('Enter the coordinates')
Na = input('Northings of A = ')
Ea = input('Eastings of A = ')

Nb = input('Northings of B = ')
Eb = input('Eastings of B = ')

Nc = input('Northings of C = ')
Ec = input('Eastings of C = ')

import matplotlib.pyplot as plt
x = [Ea,Eb,Ec,Ea]
y = [Na,Nb,Nc,Na]
plt.plot(x,y,'yellow')
plt.show()


x = [1500,1720,1244.52,1500]
y = [5930.15,6230.25,3254.62,5960.15]
plt.plot(x,'purple')
plt.show()
最佳答案 我认为从输入强制转换为int是一个问题,并且缺少Nd和Ed变量.

print('Enter the coordinates')
Na = input('Northings of A = ')
Ea = input('Eastings of A = ')
Nb = input('Northings of B = ')
Eb = input('Eastings of B = ')
Nc = input('Northings of C = ')
Ec = input('Eastings of C = ')
Nd = input('Northings of D = ')
Ed = input('Eastings of D = ')
import matplotlib.pyplot as plt
x = [int(Ea),int(Eb),int(Ec),int(Ed)]
y = [int(Na),int(Nb),int(Nc),int(Nd)]
plt.plot(x,'green')
plt.show()
x = [1500,'purple')
plt.show()

(编辑:安卓应用网)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读