【问题标题】:How to plot user interface如何绘制用户界面
【发布时间】:2021-06-10 21:14:13
【问题描述】:

注意:这就是我的代码的样子,我不断收到粗体部分的错误,我希望能够绘制一条直线,其坐标从 1,1 开始并以 (1+lineLength) 结束, 1, 这样我就有了一条水平线。我对 python 不太熟悉,所以非常感谢您的意见。

lineLengthQuestion = input("What size would you like your line? (Numbers Only)")
lineLengthQuestion = int(lineLengthQuestion)
lineLength = [1 + lineLengthQuestion]
print (f'You entered {lineLengthQuestion}')

x = [1,1]
y = [lineLength, 1]
plt.plot(x, y, color = "black", linewidth = 3)

【问题讨论】:

    标签: python matplotlib jupyter-notebook jupyter matplotlib-animation


    【解决方案1】:

    您创建了一个单元素列表,其中包含一个比 lineLengthQuestion 大 1 的数字。我认为你想要一个标量值,所以你不需要括号。

    lineLength = 1 + lineLengthQuestion
    

    【讨论】:

      猜你喜欢
      • 2010-09-25
      • 2012-02-04
      • 1970-01-01
      • 1970-01-01
      • 2022-01-24
      • 2020-08-20
      • 2010-09-05
      • 2020-02-05
      • 1970-01-01
      相关资源
      最近更新 更多