简体   繁体   English

Python 上的图表作为 plt.plot 不会显示

[英]Graphs on Python as plt.plot wont show

Hello i've been stuck on this for a while now.您好,我已经坚持了一段时间了。 My graph wont show i'm unsure if its because of my while loop:我的图表不会显示我不确定是否是因为我的 while 循环:

while True:
   temperature = input("Temperature in Kelvin. Type stop to finish")

   if temperature == "stop":
    break

   else:
     tempy = float(temperature)

   print (tempy)

and my plot:和我的 plot:

  intensities=rad(lambda_range_metres,root_mean_square_dev)
# Plot the intensity values against the wavelength in millimetres
  plt.plot(lambda_range,intensities)
  plt.title('i')
  plt.xlabel('i /i ')
  plt.ylabel('i / i')
  plt.show()

I'm not sure where i'm going wrong with this.我不确定我在哪里出错了。 Thank you谢谢

Your loop surely has nothing to do with a problem.您的循环肯定与问题无关。 Checkout the link , there are multiple possible ways to solve your problem.查看链接,有多种可能的方法可以解决您的问题。 You can also try saving your figure with plt.savefig('myfig.png') .您也可以尝试使用plt.savefig('myfig.png')保存您的图形。 If successful, then it's most probably the backend problem as suggested in the selected answer to the referenced question.如果成功,那么很可能是所选答案中所建议的后端问题。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM