Skip to content

Commit 2325aad

Browse files
cgohlkeefiring
authored andcommitted
colorbar: allow more axes positioning kwargs. Closes Issue matplotlib#357.
1 parent 620644d commit 2325aad

File tree

1 file changed

+8
-4
lines changed

1 file changed

+8
-4
lines changed

lib/matplotlib/colorbar.py

+8-4
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,10 @@
4747
of original axes between colorbar and new image axes
4848
*shrink* 1.0; fraction by which to shrink the colorbar
4949
*aspect* 20; ratio of long to short dimensions
50+
*anchor* (0.0, 0.5) if vertical; (0.5, 1.0) if horizontal;
51+
the anchor point of the colorbar axes
52+
*panchor* (1.0, 0.5) if vertical; (0.5, 0.0) if horizontal;
53+
the anchor point of the colorbar parent axes
5054
============= ====================================================
5155
5256
'''
@@ -838,15 +842,15 @@ def make_axes(parent, **kw):
838842
x1 = 1.0-fraction
839843
pb1, pbx, pbcb = pb.splitx(x1-pad, x1)
840844
pbcb = pbcb.shrunk(1.0, shrink).anchored('C', pbcb)
841-
anchor = (0.0, 0.5)
842-
panchor = (1.0, 0.5)
845+
anchor = kw.pop('anchor', (0.0, 0.5))
846+
panchor = kw.pop('panchor', (1.0, 0.5))
843847
else:
844848
pad = kw.pop('pad', 0.15)
845849
pbcb, pbx, pb1 = pb.splity(fraction, fraction+pad)
846850
pbcb = pbcb.shrunk(shrink, 1.0).anchored('C', pbcb)
847851
aspect = 1.0/aspect
848-
anchor = (0.5, 1.0)
849-
panchor = (0.5, 0.0)
852+
anchor = kw.pop('anchor', (0.5, 1.0))
853+
panchor = kw.pop('panchor', (0.5, 0.0))
850854
parent.set_position(pb1)
851855
parent.set_anchor(panchor)
852856
fig = parent.get_figure()

0 commit comments

Comments
 (0)