【问题标题】:Python Code return blank graph. How can I correct this error?Python 代码返回空白图。我该如何纠正这个错误?
【发布时间】:2020-11-18 07:26:09
【问题描述】:

x  =  np.linspace(2010,2210,20)


Tline, =  plt.plot(x,T, label="No Taxation",  linewidth=2)
TtaxLine, =  plt.plot(x,T_tax, label= "Ad Valorem", linestyle='--',  linewidth=2)
TunitLine,=  plt.plot(x,T_unit, label="Per  Unit Tax", linewidth=2)
legend= plt.legend(handles=[Tline,  TtaxLine, TunitLine], loc="upper left")
plt.title ('Effect of Taxation on   Mean  Temperature', fontsize=16)
plt.xlabel('Year')
plt.ylabel('Degrees Celsius')
plt.show ()

图表已生成,但图表中没有线条

【问题讨论】:

    标签: python matplotlib graphing


    【解决方案1】:

    您需要指定以下变量:

    T
    T_tax
    T_unit
    

    (并在顶部进行导入):

    import matplotlib.pyplot as plt
    import numpy as np
    

    【讨论】:

    猜你喜欢
    • 2016-06-23
    • 1970-01-01
    • 1970-01-01
    • 2010-10-18
    • 2021-09-11
    • 2022-09-27
    • 2022-12-07
    • 2015-03-01
    • 1970-01-01
    相关资源
    最近更新 更多