Commit 6e95994
DOC: Add note about linear colorbar scale option for TwoSlopeNorm (matplotlib#30639)
* DOC: Add note about linear colorbar scale option for TwoSlopeNorm
Addresses matplotlib#22197 by documenting the cb.ax.set_yscale('linear')
workaround for users who prefer linear colorbar spacing instead of
the default scaled spacing introduced in matplotlib 3.5.
* FIX: Apply pre-commit fixes (end-of-file and line endings)
* FIX: Use proper reStructuredText markup for inline code and class references
* DOC: Add visual example comparing scaled vs linear colorbar for TwoSlopeNorm
Replace note with side-by-side example showing:
- Left: Default scaled colorbar (centered at midpoint)
- Right: Linear colorbar using cb.ax.set_yscale('linear')
Addresses maintainer feedback from @jklymak to make the difference
more clear with a visual demonstration.
* DOC: Refine TwoSlopeNorm colorbar documentation per maintainer feedback
- Change title from 'norms with a scale' to TwoSlopeNorm-specific
- Clarify that colorbar is divided into two equal parts
- Explain screen-space vs data range difference
- Note that color-to-value mapping remains unchanged
- Address review comments from @timhoffm
* FIX: Add proper reStructuredText markup for code references
- Add backticks around .TwoSlopeNorm class reference
- Use double backticks for cb.ax.set_yscale('linear') code snippet
- Fixes documentation build errors
* Update galleries/users_explain/colors/colormapnorms.py
Co-authored-by: Tim Hoffmann <2836374+timhoffm@users.noreply.github.com>
* DOC: Address jklymak review feedback on colorbar explanation
- Rewrite explanation to avoid 'screen space' term per jklymak
- Clarify that colorbars adopt their norm's scaling by default
- Better explain TwoSlopeNorm splits colormap evenly between halves
- Change tick specification to use np.arange for clarity
- Update both cb1 and cb2 to use np.arange(-500, 4001, 500)
Addresses @jklymak review comments
* FIX: Resolve linting errors
- Fix E501: Break long line (line 289) to stay under 88 character limit
- Fix E302: Add missing blank line before function definition
All ruff checks now pass.
* FIX: Remove square brackets from np.arange in set_ticks calls
The set_ticks() method expects a 1D array with shape (N,), but wrapping
np.arange() in square brackets creates a list containing an array with
shape (1, N). This fixes the ValueError by passing the array directly.
* Update galleries/users_explain/colors/colormapnorms.py
Co-authored-by: Jody Klymak <jklymak@gmail.com>
* FIX: Remove extra blank line before section marker
Precommit linter expects only one blank line before # %% markers.
* FIX: Ensure file ends with single newline
The end-of-file-fixer precommit hook requires files to end
with exactly one newline, not multiple.
* Update galleries/users_explain/colors/colormapnorms.py
Co-authored-by: Jody Klymak <jklymak@gmail.com>
* Refactor TwoSlopeNorm colorbar example to use loop
- Replace repeated code blocks with a loop as suggested by jklymak
- Iterate over both axes with corresponding titles
- Act on the last colorbar (cb) to set linear scale for right plot
- Reduces code duplication and improves maintainability
* Fix linting errors: line length and inline comment spacing
- Wrap long comment lines to stay within 88 character limit
- Split zip() arguments across lines for better readability
- Add blank line before section marker
- All ruff checks now pass
---------
Co-authored-by: Tim Hoffmann <2836374+timhoffm@users.noreply.github.com>
Co-authored-by: Jody Klymak <jklymak@gmail.com>1 parent f380a44 commit 6e95994
1 file changed
+27
-0
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
281 | 281 | | |
282 | 282 | | |
283 | 283 | | |
| 284 | + | |
| 285 | + | |
| 286 | + | |
| 287 | + | |
| 288 | + | |
| 289 | + | |
| 290 | + | |
| 291 | + | |
| 292 | + | |
| 293 | + | |
| 294 | + | |
| 295 | + | |
| 296 | + | |
| 297 | + | |
| 298 | + | |
| 299 | + | |
| 300 | + | |
| 301 | + | |
| 302 | + | |
| 303 | + | |
| 304 | + | |
| 305 | + | |
| 306 | + | |
| 307 | + | |
| 308 | + | |
| 309 | + | |
284 | 310 | | |
285 | 311 | | |
286 | 312 | | |
| |||
290 | 316 | | |
291 | 317 | | |
292 | 318 | | |
| 319 | + | |
293 | 320 | | |
294 | 321 | | |
295 | 322 | | |
| |||
0 commit comments