Commit 193a86b
committed
Also export minor grid.
This will allow to render both major and minor gridlines in mpld3, which
fixes the following issue: mpld3/mpld3#527
As per usual, disclaimer that I co-developed this with gpt-5.1-codex,
having it figure out the issues and give implementation recommendations,
with me testing, verifying, and tidying up the code.
Here's what it has to say, especially wrt the change in API call:
- include minor tick values/length and minor grid style in axis props so minor ticks/grids render in mpld3
- read grid color/linewidth/linestyle from tick kwargs (and rcParams fallback) instead of inspecting gridlines[0], avoiding the get_gridlines(which=…) API that isn’t available on matplotlib 3.10”
Rationale for the kw/rc approach:
`Axis.get_gridlines()` doesn’t accept `which` on matplotlib 3.10, so probing `gridlines[0]` for minor/major fails. Pulling style from the tick keyword dict (which matplotlib populates with `grid_*` fields when you call `ax.grid(...)`) plus
`rcParams` defaults gives the same style without needing `get_gridlines(which=…)`, keeping compatibility and matching user-set grid styles.
(I verified, indeed get_gridlines does not allow specifying which ones - seems like an omission in matplotlib API to me)1 parent 30242fb commit 193a86b
1 file changed
Lines changed: 21 additions & 13 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
212 | 212 | | |
213 | 213 | | |
214 | 214 | | |
| 215 | + | |
| 216 | + | |
| 217 | + | |
| 218 | + | |
215 | 219 | | |
216 | 220 | | |
217 | 221 | | |
| |||
255 | 259 | | |
256 | 260 | | |
257 | 261 | | |
| 262 | + | |
258 | 263 | | |
259 | 264 | | |
260 | 265 | | |
261 | 266 | | |
262 | 267 | | |
263 | 268 | | |
264 | 269 | | |
265 | | - | |
266 | | - | |
267 | | - | |
268 | | - | |
269 | | - | |
270 | | - | |
271 | | - | |
272 | | - | |
273 | | - | |
274 | | - | |
275 | | - | |
276 | | - | |
277 | | - | |
| 270 | + | |
| 271 | + | |
| 272 | + | |
| 273 | + | |
278 | 274 | | |
279 | 275 | | |
| 276 | + | |
| 277 | + | |
| 278 | + | |
| 279 | + | |
| 280 | + | |
| 281 | + | |
| 282 | + | |
| 283 | + | |
| 284 | + | |
| 285 | + | |
| 286 | + | |
| 287 | + | |
280 | 288 | | |
281 | 289 | | |
282 | 290 | | |
| |||
0 commit comments