Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/python/332.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Python matplotlib仅显示点_Python_Matplotlib - Fatal编程技术网

Python matplotlib仅显示点

Python matplotlib仅显示点,python,matplotlib,Python,Matplotlib,我在下一个代码中绘制线和点时遇到问题,当我使用plt.plot与x4、y4一起绘制时,只显示点,我想知道问题出在哪里。我使用的是python 3.52和wingware python IDE 101 5.1 import matplotlib.pyplot as plt from itertools import chain od = float(input("Ingrese el diametro externo: ")) id = float(input("Ingrese el dia

我在下一个代码中绘制线和点时遇到问题,当我使用
plt.plot
与x4、y4一起绘制时,只显示点,我想知道问题出在哪里。我使用的是python 3.52和wingware python IDE 101 5.1

import matplotlib.pyplot as plt
from itertools import chain



od = float(input("Ingrese el diametro externo: "))
id = float(input("Ingrese el diametro interno: "))
Yp = int(input("Ingrese la cedencia de la tuberia: "))
DF2 = float(input("Ingrese factor de diseño triaxial: "))

area=((od**2)-(id**2))*0.7854
Fy=area*Yp
Fy=int(Fy)

Fy2=-(1.16*Fy)
Fy2=int(Fy2)
Fy3=(1.16*Fy)
Fy3=int(Fy3)
t = ((od - id) / 2)



s= (od/t)
s=float(s)

ca=Fy2


c_com=range(Fy2,0,2000)
c_ten=range(0,Fy3,2000)


for ca in chain(c_com,c_ten):


   ca1 = (ca / area) 
   BB = (ca1 / Yp)
   cc = ((1 - (0.75 * ((BB) ** (2)))))
   if cc<0:
      cc = 0
   d = (((cc) **(0.5)) - (0.5 * BB))
   d1 = (((cc) **(0.5)) + (0.5 * BB))
   Ype= d * (Yp)
   Ype1=d1 * (Yp)

   a = 2.8762 + (0.10679* (0.00001)*Ype )+(0.21301 * (0.0000000001) * ((Ype) ** (2)))- (0.53132 * (1E-16) * ((Ype) **(3)))

   b = 0.026233 + (0.50609 * (0.000001) * Ype)
   c = -465.93 + (0.030867 * Ype) - (0.10483 * (0.0000001) * ((Ype) ** (2))) + (0.36989 * (0.0000000000001) * ((Ype) ** (3)))
   if c < -20000 :
      break
   O = (b / a)
   f = ((46.95 * 1000000) * (((3 * O) / (2 + O)) ** (3))) / ((Ype * (((3 * O) / (2 + O) - O))) * ((1 - ((3 * O) / (2 + O)))) ** (2))

   g = f * O


   L = (c/ Ype)
   s1 = ((((a - 2) + (8 * (b+ L))) ** (0.5)) + (a - 2)) / (2 * (b + L))
   s1=abs(s1)
   s2 = (Ype * (a - f)) / (c + (Ype * (b - g)))
   s2=float(s2)
   s3 = (2 + (b / a)) / (3 * b / a)
   s3=float(s3)  


   Pc1 = 2 * Ype * ((s - 1) / (s * s))
   Pc2 = (Ype * ((a / s) - b)) - c 
   Pc3 = (Ype * ((f / s) - g))
   Pc4 = (46.95 * 1000000) / (s * ((s - 1) ** 2))


   Pc=0  
   Pc=int(Pc)


   if s<s1 : 
      Pc= Pc1

   elif s1<s<s2:
      Pc = Pc2
   elif s2 < s < s3:
      Pc= Pc3
   elif s>s3:
      Pc = Pc4

   Pe=0
   Pe = (0.875 * 2 * Ype1 * t) / od
   Pe=int(Pe)
   Pc=int(Pc) 
   if 0<ca<Fy-7000:
      coo=((-Pc/1))
      caa=(ca)
      x4=(caa,Fy)
      y4=(coo,0)
      plt.plot(x4,y4,"ro-",markersize=3)
      plt.show()


   if ca==0:
      co=str((-Pc))
      Pb=str((Pe))
      x3=[0,-Fy,-Fy,-Fy,0,Fy,Fy]
      y3=[co,co,0,Pb,Pb,Pb,0]
      plt.plot(x3,y3,color='y',linewidth=2)
导入matplotlib.pyplot作为plt
来自itertools进口链
od=浮动(输入(“入口el diametro externo:”)
id=浮动(输入(“入口el diametro interno:”)
Yp=int(输入(“块茎入口”)
DF2=浮动(输入(“三轴进入系数”)
面积=((外径**2)-(内径**2))*0.7854
Fy=面积*Yp
Fy=int(Fy)
Fy2=-(1.16*Fy)
Fy2=整数(Fy2)
Fy3=(1.16*Fy)
Fy3=整数(Fy3)
t=((od-id)/2)
s=(od/t)
s=浮动(s)
ca=Fy2
c_com=范围(2020财年)
c_十=范围(0,FY32000)
对于链中ca(c_com,c_ten):
ca1=(ca/面积)
BB=(ca1/Yp)
cc=((1-(0.75*((BB)**(2())))

if ccMove
plt.在
if
子句外显示
,并将其放在代码的末尾,或放在
for
循环的末尾


调用
plt.plot
时,会构造一个新的绘图,但不会显示,因此不会绘制图像,但已创建结构。您可以多次调用
plt.plot
,使用新数据进行绘制,这些数据将累积,当您调用
show
时,将在同一图像上绘制许多图形

谢谢你的回答,我尝试了你所说的,但情节显示了很多行,而不是一行所有的点。@Migueltro,然后尝试将调用移动到循环外的
show
。我做了,但什么也没有做change@MIGUELTORO,您能展示一个示例输出图吗?@migueltro,出于某种原因,此链接将我重定向到。演示此问题是否需要所有数学知识?将其提取为MCVE: