@@ -8967,6 +8967,14 @@ def violin(self, vpstats, positions=None, vert=None,
89678967
89688968 .. versionadded:: 3.11
89698969
8970+ For backward compatibility, if *facecolor* is not given, the body
8971+ will get an Artist-level transparency `alpha <.Artist.set_alpha>`
8972+ of 0.3, which will persist if you afterwards change the facecolor,
8973+ e.g. via ``result['bodies'][0].set_facecolor('red')``.
8974+ If *facecolor* is given, there is no Artist-level transparency.
8975+ To set transparency for *facecolor* or *edgecolor* use
8976+ ``(color, alpha)`` tuples.
8977+
89708978 linecolor : :mpltype:`color` or list of :mpltype:`color`, optional
89718979 If provided, will set the line color(s) of the violins (the
89728980 horizontal and vertical spines and body edges).
@@ -9074,13 +9082,14 @@ def cycle_color(color, alpha=None):
90749082
90759083 if facecolor is not None :
90769084 facecolor = cycle_color (facecolor )
9085+ body_artist_alpha = None
90779086 else :
9078- default_facealpha = 0.3
9087+ body_artist_alpha = 0.3
90799088 # Use default colors if user doesn't provide them
90809089 if mpl .rcParams ['_internal.classic_mode' ]:
9081- facecolor = cycle_color ('y' , alpha = default_facealpha )
9090+ facecolor = cycle_color ('y' )
90829091 else :
9083- facecolor = cycle_color (next_color , alpha = default_facealpha )
9092+ facecolor = cycle_color (next_color )
90849093
90859094 if mpl .rcParams ['_internal.classic_mode' ]:
90869095 # Classic mode uses patch.force_edgecolor=True, so we need to
@@ -9129,7 +9138,8 @@ def cycle_color(color, alpha=None):
91299138 bodies += [fill (stats ['coords' ],
91309139 - vals + pos if side in ['both' , 'low' ] else pos ,
91319140 vals + pos if side in ['both' , 'high' ] else pos ,
9132- facecolor = facecolor , edgecolor = body_edgecolor )]
9141+ facecolor = facecolor , edgecolor = body_edgecolor ,
9142+ alpha = body_artist_alpha )]
91339143 means .append (stats ['mean' ])
91349144 mins .append (stats ['min' ])
91359145 maxes .append (stats ['max' ])
0 commit comments