Uh oh!
There was an error while loading.Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork7.9k
Description
Problem
It is always a bit hard for me to remember whetheradd_axes
takes(left, bottom, right, top)
or(left, bottom, width, height)
(especially because needing to manually place axes is not so common -- but sometimes you do need it). Perhaps a solution would be to support both, or possibly some additional APIs, based on keyword (not all of them may be worth adding, I'm just trying to be exhaustive):
fig.add_axes([l,b,w,h])# current APIfig.add_axes(rect=[l,b,w,h])# current API# add some simple aliasesfig.add_axes(lbwh=[l,b,w,h])fig.add_axes(xxyy=[x0,x1,y0,y1])fig.add_axes(xyxy=[x0,y0,x1,y1])fig.add_axes(corners=[(x0,y0), (x1,y1)])# cf. discussion on grouping arguments to vector().
(Note that all these can probably be implemented "relatively" easily via setters, i.e. default of rect=None, pass the kwargs to the setters, and at the end of of__init__
, check that one of the position-specifying args has been passed.)
Alternatively,add_axes
also supports taking aBbox
, so one can write
fig.add_axes(Bbox([(x0,y0), (x1,y1)]))# Perhaps that's the most rememberable for me...fig.add_axes(Bbox.from_extents(x0,y0,x1,y1))fig.add_axes(Bbox.from_bounds(x0,y0,w,h))
but note that the namebounds
("start-delta") is not consistent withAxes.set_xbound
/Axes.set_ybound
(and the more rarely usedSpine.set_bounds
), which both use the "start-end" convention :(
Proposed solution
No response