【发布时间】:2021-04-08 12:58:00
【问题描述】:
我希望每个点都有不同的颜色误差条,如下所示:
我正在尝试这段代码:
ax.errorbar([450.,500.], [4,5] , xerr = ([20.,15.],[20.,15.]), fmt ='o',color=['r','b'], ecolor = ['r','b'],ms=4, capsize=4,)
但我收到以下错误。我做错了什么?
238 # float)` and `np.array(...).astype(float)` all convert "0.5" to 0.5.
239 # Test dimensionality to reject single floats.
--> 240 raise ValueError("Invalid RGBA argument: {!r}".format(orig_c))
241 # Return a tuple to prevent the cached value from being modified.
242 c = tuple(c.astype(float))
ValueError: Invalid RGBA argument: ['r', 'b']
【问题讨论】:
-
你打算通过将错误栏的“颜色”属性设置为
['r', 'b']来实现什么? -
我希望每个点的误差条具有不同的颜色。如果我做 color = 'blue' 它工作正常。
-
我已经添加了我想要的东西的图像
标签: python matplotlib errorbar