好的,我想问题很简单。我想做的是一个条形图,其中数据是按顺序绘制的,忽略了当前值是否小于上一个值。例如,以下内容:
import matplotlib.pyplot as plt
x = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]
y = [10, 20, 30, 40, 50, 60, 70, 80, 90, 100]
for index in range(len(x)):
plt.bar(x[index], y[index])
返回此图:
但是,如果我向x和y添加新值(新的x值小于先前的值),例如:
import matplotlib.pyplot as plt
x = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 2]
y = [10, 20, 30, 40, 50, 60, 70, 80, 90, 100, 200]
for index in range(len(x)):
plt.bar(x[index], y[index])
情节是这样的:
因此,最后,如何在10之后绘制这个新的2值,而不是直接回到先前绘制的值?
本文收集自互联网,转载请注明来源。
如有侵权,请联系[email protected] 删除。
我来说两句