Commit f6513e7
committed
Fix Axes.grid() to respect alpha in color tuples
When calling ax.grid(color=(R, G, B, A)) with a 4-element color tuple,
the alpha channel was being ignored, causing gridlines to appear fully
opaque instead of with the specified transparency.
The issue occurred in two locations:
1. Tick.__init__: When creating ticks, if grid_alpha was None but the
color had an alpha channel, the alpha wasn't extracted from the color
2. Tick._apply_params: When updating gridlines via grid(), colors with
alpha weren't being decomposed into separate color and alpha params
This fix extracts the alpha value from color tuples using
mcolors.to_rgba() and sets both the color (RGB only) and alpha
separately, ensuring proper transparency rendering.
Fixes #222311 parent f1ea23f commit f6513e7
2 files changed
Lines changed: 45 additions & 11 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
140 | 140 | | |
141 | 141 | | |
142 | 142 | | |
143 | | - | |
144 | | - | |
145 | | - | |
146 | | - | |
147 | | - | |
148 | | - | |
149 | | - | |
150 | | - | |
151 | | - | |
152 | | - | |
153 | | - | |
| 143 | + | |
| 144 | + | |
| 145 | + | |
| 146 | + | |
| 147 | + | |
| 148 | + | |
| 149 | + | |
| 150 | + | |
| 151 | + | |
| 152 | + | |
| 153 | + | |
| 154 | + | |
| 155 | + | |
| 156 | + | |
154 | 157 | | |
155 | 158 | | |
156 | 159 | | |
| |||
348 | 351 | | |
349 | 352 | | |
350 | 353 | | |
| 354 | + | |
| 355 | + | |
| 356 | + | |
| 357 | + | |
| 358 | + | |
| 359 | + | |
| 360 | + | |
| 361 | + | |
| 362 | + | |
351 | 363 | | |
352 | 364 | | |
353 | 365 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
6133 | 6133 | | |
6134 | 6134 | | |
6135 | 6135 | | |
| 6136 | + | |
| 6137 | + | |
| 6138 | + | |
| 6139 | + | |
| 6140 | + | |
| 6141 | + | |
| 6142 | + | |
| 6143 | + | |
| 6144 | + | |
| 6145 | + | |
| 6146 | + | |
| 6147 | + | |
| 6148 | + | |
| 6149 | + | |
| 6150 | + | |
| 6151 | + | |
| 6152 | + | |
| 6153 | + | |
| 6154 | + | |
| 6155 | + | |
| 6156 | + | |
| 6157 | + | |
6136 | 6158 | | |
6137 | 6159 | | |
6138 | 6160 | | |
| |||
0 commit comments