问题描述
我试图绘制水平条形图及其相应的误差线,但是,当我定义 capsize 时,出现ValueError:无效的RGBA参数.我在 Jupyter Notebook 中运行该脚本,但该错误在 linux shell 中仍然存在.
我应该注意,我希望条形图的颜色及其误差条相匹配.
在这里查看其他问题,当颜色的形状错误时,似乎会引发此错误,但是我看不出如何解决我的问题.这是重现该错误的代码:
values = {0: [0.29, 0.21, 0.43],1:[0.16、0.14、0.21],2: [0.73, 0.11, 0.14]}错误= {0:[0.13、0.02、0.08],1:[0.066,0.08,0.1],2: [0.21, 0.027, 0.078]}图,轴= plt.subplots(1,3,图大小=(3,3))颜色=['#7bad10', '#103cad', '#ad109a']为了计数,用枚举(axes)中的ax表示:xerr = [errors.keys()中x的errors [x] [count]个ax.barh([0,0.5,1],[values[x][count] for x in values.keys()],[0.3, 0.3, 0.3],颜色=颜色,#capsize = 2,xerr = xerr,error_kw = {'elinewidth':1'ecolor':颜色})如果count!= 0:ax.get_yaxis().set_visible(False)ax.set_xlim([0, 1])
此代码现在可以正常工作,但是当我取消注释 capsize 时,它会引发错误.如果我注释 ecolor 行,那么我可以毫无问题地使用 capsize,但我不能同时定义它们.我怎样才能解决这个问题?谢谢你.
此外,这是该错误的更详细输出:
回调错误 .post_execute at 0x000001A1EB387620>(对于post_execute):---------------------------------------------------------------------------TypeError Traceback(最近一次通话)~\Anaconda3\envs\newDENSITY\lib\site-packages\matplotlib\colors.py in to_rgba(c, alpha)173 尝试:->174 rgba = _colors_full_map.cache [c,alpha]175除外((KeyError,TypeError):#不在缓存中,或不可哈希.类型错误:不可散列的类型:列表"在处理上述异常的过程中,又发生了一个异常:ValueError Traceback(最近一次通话)~\Anaconda3\envs\newDENSITY\lib\site-packages\matplotlib\pyplot.py 在 post_execute()107 def post_execute():108如果matplotlib.is_interactive():->第109话110111#IPython> = 2~\Anaconda3\envs\newDENSITY\lib\site-packages\matplotlib\_pylab_helpers.py in draw_all(cls, force)对于cls.get_all_fig_managers()中的f_mgr为130:131 如果强制或 f_mgr.canvas.figure.stale:->第132话133134 atexit.register(Gcf.destroy_all)〜\ Anaconda3 \ envs \ newDENSITY \ lib \ site-packages \ matplotlib \ backend_bases.py在draw_idle中(self,* args,** kwargs)1897如果不是自我.1898 with self._idle_draw_cntx():->1899 self.draw(*args, **kwargs)1900年1901 def draw_cursor(自我,事件):~\Anaconda3\envs\newDENSITY\lib\site-packages\matplotlib\backends\backend_agg.py in draw(self)400工具栏= self.toolbar401尝试:->402 self.figure.draw(self.renderer)403#使用此绘制可能需要一个GUI类来更新窗口,因此404 # 不要忘记调用超类.~\Anaconda3\envs\newDENSITY\lib\site-packages\matplotlib\artist.py in draw_wrapper(artist, renderer, *args, **kwargs)48 renderer.start_filter()49--->50 返回绘制(艺术家、渲染器、*args、**kwargs)51最后:52 如果 Artist.get_agg_filter() 不是 None:〜\ Anaconda3 \ envs \ newDENSITY \ lib \ site-packages \ matplotlib \ figure.py在draw(自身,渲染器)中1647第1648章->1649 渲染器、自我、艺术家、self.suppressComposite)16501651 renderer.close_group('人物')~\Anaconda3\envs\newDENSITY\lib\site-packages\matplotlib\image.py in _draw_list_compositing_images(渲染器,父级,艺术家,suppress_composite)第136话137位艺术家艺术家:->138 a.draw(渲染器)139 其他:140 # 将任何相邻的图像合成在一起~\Anaconda3\envs\newDENSITY\lib\site-packages\matplotlib\artist.py in draw_wrapper(artist, renderer, *args, **kwargs)48 renderer.start_filter()49--->50 返回绘制(艺术家、渲染器、*args、**kwargs)51 最后:52如果artist.get_agg_filter()不是None:〜\ Anaconda3 \ envs \ newDENSITY \ lib \ site-packages \ matplotlib \ axes \ _base.py在draw(self,renderer,inframe)中2626 renderer.stop_rasterizing()2627->2628 mimage._draw_list_compositing_images(渲染器,自我,艺术家)26292630 renderer.close_group('axes')~\Anaconda3\envs\newDENSITY\lib\site-packages\matplotlib\image.py in _draw_list_compositing_images(渲染器,父级,艺术家,suppress_composite)136如果not_composite或not has_images:137 对于艺术家:->138 a.draw(渲染器)139其他:140#将任何相邻图像合成在一起〜\ Anaconda3 \ envs \ newDENSITY \ lib \ site-packages \ matplotlib \ artist.py在draw_wrapper中(artist,renderer,* args,** kwargs)48 renderer.start_filter()49--->50 返回绘制(艺术家、渲染器、*args、**kwargs)51最后:52如果artist.get_agg_filter()不是None:〜\ Anaconda3 \ envs \ newDENSITY \ lib \ site-packages \ matplotlib \ lines.py在draw(自身,渲染器)中779第780话->第 781 章782 fc_rgba = mcolors.to_rgba(第783页〜\ Anaconda3 \ envs \ newDENSITY \ lib \ site-packages \ matplotlib \ colors.py在to_rgba(c,alpha)中第174话175除外((KeyError,TypeError):#不在缓存中,或不可哈希.->第176话177尝试:178 _colors_full_map.cache [c,alpha] = rgba~\Anaconda3\envs\newDENSITY\lib\site-packages\matplotlib\colors.py in _to_rgba_no_colorcycle(c, alpha)225#float)和np.array(...).astype(float)都将"0.5"转换为0.5.226 # 测试维度以拒绝单个浮点数.->227引发ValueError(无效的RGBA参数:{!r}".格式(orig_c))228#返回一个元组,以防止修改缓存的值.第229话ValueError:无效的RGBA参数:['#7bad10','#103cad','#ad109a']---------------------------------------------------------------------------TypeError Traceback(最近一次通话)〜\ Anaconda3 \ envs \ newDENSITY \ lib \ site-packages \ matplotlib \ colors.py在to_rgba(c,alpha)中173尝试:->第174话175除外((KeyError,TypeError):#不在高速缓存中,或不可散列.类型错误:不可散列的类型:列表"在处理上述异常的过程中,又发生了一个异常:ValueError Traceback(最近一次通话)~\Anaconda3\envs\newDENSITY\lib\site-packages\IPython\core\formatters.py in __call__(self, obj)第339关340 其他:->341返回打印机(obj)342#最后寻找特殊的方法名称343 方法= get_real_method(对象,self.print_method)〜\ Anaconda3 \ envs \ newDENSITY \ lib \ site-packages \ IPython \ core \ pylabtools.py在< lambda>中(图)242243 如果 'png' 格式:->244 png_formatter.for_type(图,lambda fig:print_figure(fig,'png',**kwargs))245 如果格式为 'retina' 或格式为 'png2x':第246话〜\ anaconda3 \ envs \ newDENSITY \ lib \ site-packages \ IPython \ core \ pylabtools.py在print_figure(fig,fmt,bbox_inches,** kwargs)中126127 bytes_io =字节IO()->第128话129 数据 = bytes_io.getvalue()130 如果 fmt == 'svg':〜\ Anaconda3 \ envs \ newDENSITY \ lib \ site-packages \ matplotlib \ backend_bases.py在print_figure中2047 direction = orientation,2048 dryrun = True,->2049年**2050渲染器= self.figure._cachedRenderer2051 bbox_artists = kwargs.pop("bbox_extra_artists",无)〜\ anaconda3 \ envs \ newDENSITY \ lib \ site-packages \ matplotlib \ backends \ backend_agg.py在print_png中(self,filename_or_obj,* args,** kwargs)508第509话->510:FigureCanvasAgg.draw(个体)511 渲染器 = self.get_renderer()512~\Anaconda3\envs\newDENSITY\lib\site-packages\matplotlib\backends\backend_agg.py in draw(self)400工具栏= self.toolbar401尝试:->402 self.figure.draw(self.renderer)403#使用此绘制可能需要一个GUI类来更新窗口,因此404#不要忘记调用超类.〜\ Anaconda3 \ envs \ newDENSITY \ lib \ site-packages \ matplotlib \ artist.py在draw_wrapper中(艺术家,渲染器,* args,** kwargs)48 renderer.start_filter()49--->50回程画(艺术家,渲染器,* args,** kwargs)51最后:52 如果 Artist.get_agg_filter() 不是 None:~\Anaconda3\envs\newDENSITY\lib\site-packages\matplotlib\figure.py in draw(self, renderer)1647第1648章->1649渲染器,自我,艺术家,self.suppress(复合)16501651 renderer.close_group('图')~\Anaconda3\envs\newDENSITY\lib\site-packages\matplotlib\image.py in _draw_list_compositing_images(渲染器,父级,艺术家,suppress_composite)第136话137位艺术家艺术家:->138 a.draw(渲染器)139 其他:140#将任何相邻图像合成在一起~\Anaconda3\envs\newDENSITY\lib\site-packages\matplotlib\artist.py in draw_wrapper(artist, renderer, *args, **kwargs)48 renderer.start_filter()49--->50回程画(艺术家,渲染器,* args,** kwargs)51最后:52 如果 Artist.get_agg_filter() 不是 None:~\Anaconda3\envs\newDENSITY\lib\site-packages\matplotlib\axes\_base.py in draw(self, renderer, inframe)2626 renderer.stop_rasterizing()2627->2628 mimage._draw_list_compositing_images(渲染器,自我,艺术家)26292630 renderer.close_group('axes')_draw_list_compositing_images中的〜\ Anaconda3 \ envs \ newDENSITY \ lib \ site-packages \ matplotlib \ image.py(渲染器,父级,艺术家,suppress_composite)136如果not_composite或not has_images:137位艺术家艺术家:->138 a.draw(渲染器)139其他:140 # 将任何相邻的图像合成在一起~\Anaconda3\envs\newDENSITY\lib\site-packages\matplotlib\artist.py in draw_wrapper(artist, renderer, *args, **kwargs)48 renderer.start_filter()49--->50 返回绘制(艺术家、渲染器、*args、**kwargs)51 最后:52如果artist.get_agg_filter()不是None:~\Anaconda3\envs\newDENSITY\lib\site-packages\matplotlib\lines.py in draw(self, renderer)779第780章->第 781 章782 fc_rgba = mcolors.to_rgba(第783页~\Anaconda3\envs\newDENSITY\lib\site-packages\matplotlib\colors.py in to_rgba(c, alpha)第174话175除外((KeyError,TypeError):#不在高速缓存中,或不可散列.->第176话177尝试:第178话~\Anaconda3\envs\newDENSITY\lib\site-packages\matplotlib\colors.py in _to_rgba_no_colorcycle(c, alpha)225#float)和np.array(...).astype(float)都将"0.5"转换为0.5.226 # 测试维度以拒绝单个浮点数.->227引发ValueError(无效的RGBA参数:{!r}".格式(orig_c))228 # 返回一个元组,防止缓存的值被修改.229 c =元组(c.astype(float))值错误:无效的 RGBA 参数:['#7bad10'、'#103cad'、'#ad109a']
当前无法通过条形API创建多色瓶盖.(
I am trying to plot horizontal bar plots with their corresponding error bars, however, when I define capsize I get a ValueError: Invalid RGBA argument. I am running the script in a Jupyter Notebook, but the error persists in a linux shell as well.
I should note that I want the colors of the bar plots and their error bars to match.
Looking at other questions here, it seems that this error is thrown when the shape of color is wrong, but I don't see how this fixes my problem.Here is the code to reproduce the error:
values = {0: [0.29, 0.21, 0.43],
1: [0.16, 0.14, 0.21],
2: [0.73, 0.11, 0.14]}
errors = {0: [0.13, 0.02, 0.08],
1: [0.066, 0.08, 0.1],
2: [0.21, 0.027, 0.078]}
fig, axes = plt.subplots(1, 3, figsize=(3,3))
colors=['#7bad10', '#103cad', '#ad109a']
for count, ax in enumerate(axes):
xerr = [errors[x][count] for x in errors.keys()]
ax.barh([0, 0.5, 1],
[values[x][count] for x in values.keys()],
[0.3, 0.3, 0.3],
color=colors,
# capsize=2,
xerr=xerr,
error_kw = {
'elinewidth': 1,
'ecolor' : colors}
)
if count != 0:
ax.get_yaxis().set_visible(False)
ax.set_xlim([0, 1])
This code as it is now, works fine, but when I uncomment capsize it throws the error. If I comment the ecolor line, then I can use capsize without a problem, but I cannot define both of them.How can I fix this? Thank you.
Also, here is a more detailed output of the error:
Error in callback <function install_repl_displayhook.<locals>.post_execute at 0x000001A1EB387620> (for post_execute):
---------------------------------------------------------------------------
TypeError Traceback (most recent call last)
~\Anaconda3\envs\newDENSITY\lib\site-packages\matplotlib\colors.py in to_rgba(c, alpha)
173 try:
--> 174 rgba = _colors_full_map.cache[c, alpha]
175 except (KeyError, TypeError): # Not in cache, or unhashable.
TypeError: unhashable type: 'list'
During handling of the above exception, another exception occurred:
ValueError Traceback (most recent call last)
~\Anaconda3\envs\newDENSITY\lib\site-packages\matplotlib\pyplot.py in post_execute()
107 def post_execute():
108 if matplotlib.is_interactive():
--> 109 draw_all()
110
111 # IPython >= 2
~\Anaconda3\envs\newDENSITY\lib\site-packages\matplotlib\_pylab_helpers.py in draw_all(cls, force)
130 for f_mgr in cls.get_all_fig_managers():
131 if force or f_mgr.canvas.figure.stale:
--> 132 f_mgr.canvas.draw_idle()
133
134 atexit.register(Gcf.destroy_all)
~\Anaconda3\envs\newDENSITY\lib\site-packages\matplotlib\backend_bases.py in draw_idle(self, *args, **kwargs)
1897 if not self._is_idle_drawing:
1898 with self._idle_draw_cntx():
-> 1899 self.draw(*args, **kwargs)
1900
1901 def draw_cursor(self, event):
~\Anaconda3\envs\newDENSITY\lib\site-packages\matplotlib\backends\backend_agg.py in draw(self)
400 toolbar = self.toolbar
401 try:
--> 402 self.figure.draw(self.renderer)
403 # A GUI class may be need to update a window using this draw, so
404 # don't forget to call the superclass.
~\Anaconda3\envs\newDENSITY\lib\site-packages\matplotlib\artist.py in draw_wrapper(artist, renderer, *args, **kwargs)
48 renderer.start_filter()
49
---> 50 return draw(artist, renderer, *args, **kwargs)
51 finally:
52 if artist.get_agg_filter() is not None:
~\Anaconda3\envs\newDENSITY\lib\site-packages\matplotlib\figure.py in draw(self, renderer)
1647
1648 mimage._draw_list_compositing_images(
-> 1649 renderer, self, artists, self.suppressComposite)
1650
1651 renderer.close_group('figure')
~\Anaconda3\envs\newDENSITY\lib\site-packages\matplotlib\image.py in _draw_list_compositing_images(renderer, parent, artists, suppress_composite)
136 if not_composite or not has_images:
137 for a in artists:
--> 138 a.draw(renderer)
139 else:
140 # Composite any adjacent images together
~\Anaconda3\envs\newDENSITY\lib\site-packages\matplotlib\artist.py in draw_wrapper(artist, renderer, *args, **kwargs)
48 renderer.start_filter()
49
---> 50 return draw(artist, renderer, *args, **kwargs)
51 finally:
52 if artist.get_agg_filter() is not None:
~\Anaconda3\envs\newDENSITY\lib\site-packages\matplotlib\axes\_base.py in draw(self, renderer, inframe)
2626 renderer.stop_rasterizing()
2627
-> 2628 mimage._draw_list_compositing_images(renderer, self, artists)
2629
2630 renderer.close_group('axes')
~\Anaconda3\envs\newDENSITY\lib\site-packages\matplotlib\image.py in _draw_list_compositing_images(renderer, parent, artists, suppress_composite)
136 if not_composite or not has_images:
137 for a in artists:
--> 138 a.draw(renderer)
139 else:
140 # Composite any adjacent images together
~\Anaconda3\envs\newDENSITY\lib\site-packages\matplotlib\artist.py in draw_wrapper(artist, renderer, *args, **kwargs)
48 renderer.start_filter()
49
---> 50 return draw(artist, renderer, *args, **kwargs)
51 finally:
52 if artist.get_agg_filter() is not None:
~\Anaconda3\envs\newDENSITY\lib\site-packages\matplotlib\lines.py in draw(self, renderer)
779
780 ec_rgba = mcolors.to_rgba(
--> 781 self.get_markeredgecolor(), self._alpha)
782 fc_rgba = mcolors.to_rgba(
783 self._get_markerfacecolor(), self._alpha)
~\Anaconda3\envs\newDENSITY\lib\site-packages\matplotlib\colors.py in to_rgba(c, alpha)
174 rgba = _colors_full_map.cache[c, alpha]
175 except (KeyError, TypeError): # Not in cache, or unhashable.
--> 176 rgba = _to_rgba_no_colorcycle(c, alpha)
177 try:
178 _colors_full_map.cache[c, alpha] = rgba
~\Anaconda3\envs\newDENSITY\lib\site-packages\matplotlib\colors.py in _to_rgba_no_colorcycle(c, alpha)
225 # float)` and `np.array(...).astype(float)` all convert "0.5" to 0.5.
226 # Test dimensionality to reject single floats.
--> 227 raise ValueError("Invalid RGBA argument: {!r}".format(orig_c))
228 # Return a tuple to prevent the cached value from being modified.
229 c = tuple(c.astype(float))
ValueError: Invalid RGBA argument: ['#7bad10', '#103cad', '#ad109a']
---------------------------------------------------------------------------
TypeError Traceback (most recent call last)
~\Anaconda3\envs\newDENSITY\lib\site-packages\matplotlib\colors.py in to_rgba(c, alpha)
173 try:
--> 174 rgba = _colors_full_map.cache[c, alpha]
175 except (KeyError, TypeError): # Not in cache, or unhashable.
TypeError: unhashable type: 'list'
During handling of the above exception, another exception occurred:
ValueError Traceback (most recent call last)
~\Anaconda3\envs\newDENSITY\lib\site-packages\IPython\core\formatters.py in __call__(self, obj)
339 pass
340 else:
--> 341 return printer(obj)
342 # Finally look for special method names
343 method = get_real_method(obj, self.print_method)
~\Anaconda3\envs\newDENSITY\lib\site-packages\IPython\core\pylabtools.py in <lambda>(fig)
242
243 if 'png' in formats:
--> 244 png_formatter.for_type(Figure, lambda fig: print_figure(fig, 'png', **kwargs))
245 if 'retina' in formats or 'png2x' in formats:
246 png_formatter.for_type(Figure, lambda fig: retina_figure(fig, **kwargs))
~\Anaconda3\envs\newDENSITY\lib\site-packages\IPython\core\pylabtools.py in print_figure(fig, fmt, bbox_inches, **kwargs)
126
127 bytes_io = BytesIO()
--> 128 fig.canvas.print_figure(bytes_io, **kw)
129 data = bytes_io.getvalue()
130 if fmt == 'svg':
~\Anaconda3\envs\newDENSITY\lib\site-packages\matplotlib\backend_bases.py in print_figure(self, filename, dpi, facecolor, edgecolor, orientation, format, bbox_inches, **kwargs)
2047 orientation=orientation,
2048 dryrun=True,
-> 2049 **kwargs)
2050 renderer = self.figure._cachedRenderer
2051 bbox_artists = kwargs.pop("bbox_extra_artists", None)
~\Anaconda3\envs\newDENSITY\lib\site-packages\matplotlib\backends\backend_agg.py in print_png(self, filename_or_obj, *args, **kwargs)
508
509 """
--> 510 FigureCanvasAgg.draw(self)
511 renderer = self.get_renderer()
512
~\Anaconda3\envs\newDENSITY\lib\site-packages\matplotlib\backends\backend_agg.py in draw(self)
400 toolbar = self.toolbar
401 try:
--> 402 self.figure.draw(self.renderer)
403 # A GUI class may be need to update a window using this draw, so
404 # don't forget to call the superclass.
~\Anaconda3\envs\newDENSITY\lib\site-packages\matplotlib\artist.py in draw_wrapper(artist, renderer, *args, **kwargs)
48 renderer.start_filter()
49
---> 50 return draw(artist, renderer, *args, **kwargs)
51 finally:
52 if artist.get_agg_filter() is not None:
~\Anaconda3\envs\newDENSITY\lib\site-packages\matplotlib\figure.py in draw(self, renderer)
1647
1648 mimage._draw_list_compositing_images(
-> 1649 renderer, self, artists, self.suppressComposite)
1650
1651 renderer.close_group('figure')
~\Anaconda3\envs\newDENSITY\lib\site-packages\matplotlib\image.py in _draw_list_compositing_images(renderer, parent, artists, suppress_composite)
136 if not_composite or not has_images:
137 for a in artists:
--> 138 a.draw(renderer)
139 else:
140 # Composite any adjacent images together
~\Anaconda3\envs\newDENSITY\lib\site-packages\matplotlib\artist.py in draw_wrapper(artist, renderer, *args, **kwargs)
48 renderer.start_filter()
49
---> 50 return draw(artist, renderer, *args, **kwargs)
51 finally:
52 if artist.get_agg_filter() is not None:
~\Anaconda3\envs\newDENSITY\lib\site-packages\matplotlib\axes\_base.py in draw(self, renderer, inframe)
2626 renderer.stop_rasterizing()
2627
-> 2628 mimage._draw_list_compositing_images(renderer, self, artists)
2629
2630 renderer.close_group('axes')
~\Anaconda3\envs\newDENSITY\lib\site-packages\matplotlib\image.py in _draw_list_compositing_images(renderer, parent, artists, suppress_composite)
136 if not_composite or not has_images:
137 for a in artists:
--> 138 a.draw(renderer)
139 else:
140 # Composite any adjacent images together
~\Anaconda3\envs\newDENSITY\lib\site-packages\matplotlib\artist.py in draw_wrapper(artist, renderer, *args, **kwargs)
48 renderer.start_filter()
49
---> 50 return draw(artist, renderer, *args, **kwargs)
51 finally:
52 if artist.get_agg_filter() is not None:
~\Anaconda3\envs\newDENSITY\lib\site-packages\matplotlib\lines.py in draw(self, renderer)
779
780 ec_rgba = mcolors.to_rgba(
--> 781 self.get_markeredgecolor(), self._alpha)
782 fc_rgba = mcolors.to_rgba(
783 self._get_markerfacecolor(), self._alpha)
~\Anaconda3\envs\newDENSITY\lib\site-packages\matplotlib\colors.py in to_rgba(c, alpha)
174 rgba = _colors_full_map.cache[c, alpha]
175 except (KeyError, TypeError): # Not in cache, or unhashable.
--> 176 rgba = _to_rgba_no_colorcycle(c, alpha)
177 try:
178 _colors_full_map.cache[c, alpha] = rgba
~\Anaconda3\envs\newDENSITY\lib\site-packages\matplotlib\colors.py in _to_rgba_no_colorcycle(c, alpha)
225 # float)` and `np.array(...).astype(float)` all convert "0.5" to 0.5.
226 # Test dimensionality to reject single floats.
--> 227 raise ValueError("Invalid RGBA argument: {!r}".format(orig_c))
228 # Return a tuple to prevent the cached value from being modified.
229 c = tuple(c.astype(float))
ValueError: Invalid RGBA argument: ['#7bad10', '#103cad', '#ad109a']
It is currently not possible to create multicolor caps through the bar API. (#14480)
A hack would be to use the following function
def colorize_errorbars(cont, colors, ax=None):
ax = ax or plt.gca()
scs = []
for line in cont.errorbar.lines[1]:
line.remove()
sc = ax.scatter(*line.get_data(), c=colors, marker=line.get_marker(),
s=line.get_markersize()**2, zorder=3)
scs.append(sc)
cont.errorbar.lines = (cont.errorbar.lines[0], tuple(scs), cont.errorbar.lines[2])
for col in cont.errorbar.lines[2]:
col.set_color(colors)
e.g., like
fig, ax = plt.subplots( figsize=(3,3))
colors=['crimson', 'limegreen', 'indigo']
bars = ax.bar( [0,1,2],
[5,3,4],
linewidth=2,
color="papayawhip",
edgecolor=colors,
capsize=3,
yerr=[1.5, 1, 1.5],
error_kw = { 'elinewidth': 2, }
)
colorize_errorbars(bars, colors, ax)
plt.show()
这篇关于为什么在定义“capsize"时会得到无效的 RGBA 参数 ValueError?我的错误吧?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!