Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit7884314

Browse files
committed
Redo colorbar overhaul.
Previous overhaul packaged an inner and outer axes in a container"ColorbarAxes" and tried to dispatch methods between them.This overhaul takes the _much_ simpler approach of resizing theimage using a custom _axes_locator that a) calls any existing locatorb) or just uses the axes default position. The custom _axes_locatorthen shrinks the axes in the appropriate direction to make room forextend tri/rectangles. As with the previous fix, the extendtri/rectangles are drawn as patches in axes co-ordinates, rather thanpcolormesh in "data" co-ordinates.
1 parent4b7b2c9 commit7884314

File tree

14 files changed

+564
-563
lines changed

14 files changed

+564
-563
lines changed

‎doc/api/next_api_changes/behavior/20054-JMK.rst

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,3 @@
1-
Axes used to make colorbar now wrapped
2-
======================================
3-
4-
The axes used to place a colorbar is now wrapped by a new parent class
5-
(``ColorbarAxes``) when the colorbar is created::
6-
7-
cb = fig.colorbar(im, cax=cax)
8-
9-
This means that ``cb.ax`` is no longer the same object as ``cax``. However,
10-
we map all the methods from ``cb.ax`` onto ``cax`` so ``cax`` should remain
11-
functionally the same as ``cb.ax``.
12-
131
Colorbar lines no longer clipped
142
================================
153

‎lib/matplotlib/_constrained_layout.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -575,7 +575,11 @@ def _reposition_colorbar(cbax, renderer, *, offset=None):
575575
pbcb=trans_fig_to_subfig.transform_bbox(pbcb)
576576
cbax.set_transform(fig.transSubfigure)
577577
cbax._set_position(pbcb)
578-
cbax.set_aspect(aspect,anchor=anchor,adjustable='box')
578+
cbax.set_anchor(anchor)
579+
iflocationin ['bottom','top']:
580+
aspect=1/aspect
581+
cbax.set_box_aspect(aspect)
582+
cbax.set_aspect('auto')
579583
returnoffset
580584

581585

‎lib/matplotlib/axes/_base.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2371,6 +2371,8 @@ def _update_patch_limits(self, patch):
23712371
return
23722372
patch_trf=patch.get_transform()
23732373
updatex,updatey=patch_trf.contains_branch_seperately(self.transData)
2374+
ifnot (updatexorupdatey):
2375+
return
23742376
ifself.name!="rectilinear":
23752377
# As in _update_line_limits, but for axvspan.
23762378
ifupdatexandpatch_trf==self.get_yaxis_transform():

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp