You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
[Bug]: Stackplot does not pass facecolor(s) correctly to fill_between #30804
I'm getting an error when specifying facecolor or facecolors for stackplot. Passing color or edgecolor does work however.
Code for reproduction
frommatplotlibimportpyplotaspltx= [0, 1, 2]
y= [10, 20, 30]
# Gives error "got multiple values for keyword argument 'facecolor'"plt.stackplot(x, y, facecolor='red')
# Gives error "Got both 'facecolor' and 'facecolors'"plt.stackplot(x, y, facecolors='red')
Actual outcome
When specifying facecolor for stackplot, I get the error: "TypeError: matplotlib.axes._axes.Axes.fill_between() got multiple values for keyword argument 'facecolor'".
When specyfing facecolors for stackplot, I get the error: "TypeError: Got both 'facecolor' and 'facecolors', which are aliases of one another".
Expected outcome
It should pass the facecolor(s) to fill_between. How it does that exactly is open for interpretation: I would prefer if it would pass a list of colors as individual colors to subsequent fill_between calls (similar to how stackplot already interprets the color argument)
I agree with you that it should support face color/facecolors since we document that arguments are pass through.
Question is should it error out if folks pass color + facecolor or color + edgecolor? Other option is figuring out and communicating an order of precedence, and that seems like asking for confusion.
Question is should it error out if folks pass color + facecolor or color + edgecolor? Other option is figuring out and communicating an order of precedence, and that seems like asking for confusion.
- 'b' if in classic mode else the result of ``get_next_color_func()``
which means that the resolution to this issue is (I think) to add support for facecolor/facecolors to stackplot and handle color+facecolor being passed in together by giving facecolor precedence.
Activity
story645 commentedon Dec 2, 2025
I agree with you that it should support face color/facecolors since we document that arguments are pass through.
Question is should it error out if folks pass color + facecolor or color + edgecolor? Other option is figuring out and communicating an order of precedence, and that seems like asking for confusion.
timhoffm commentedon Dec 2, 2025
Compare what
bar()andscatter()do.story645 commentedon Dec 3, 2025
They both go w/ facecolor has precedence:
matplotlib/lib/matplotlib/axes/_axes.py
Lines 5000 to 5006 in 3323161
which means that the resolution to this issue is (I think) to add support for facecolor/facecolors to stackplot and handle color+facecolor being passed in together by giving facecolor precedence.
rcomer commentedon Dec 3, 2025
This has parallels with #30739. Should we factor out some common style parameter handling for these methods that repeatedly call another method?
rcomer commentedon Dec 3, 2025
I have started working on a branch.