New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Inner colorbar & Outer colorbar #691
Conversation
default to the current image. | ||
|
||
*loc* | ||
location code as in Legend |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Requiring a numeric code is rather unfriendly and harms readability of user code. It would be nice to have location specifications and codes factored out, and encourage use of names. Even in mpl code, names would be better where possible. One concise naming method for such location is map-oriented: e.g. NE is upper right, CE is center right, C is center, etc. Or one could use T for top, B for bottom, L for left, R for right, and C for center.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
My vote would be to be consistent with how legends are done (but without "best"). So, map names would be best.
I agree with the other comments here. If those were addressed, I think this would be a worthwhile addition. Also, this should have a regression test. |
@@ -631,13 +631,15 @@ def expanded(self, sw, sh): | |||
a = np.array([[-deltaw, -deltah], [deltaw, deltah]]) | |||
return Bbox(self._points + a) | |||
|
|||
def padded(self, p): | |||
def padded(self, p, pady=None): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I can't help but see one word with this variable name, I think the variable name ypadding
would probably make things clearer (I would personally go for y_padding
, but that is probably a bit inconsistent with other variable names in matplotlib).
I find it a real shame to see that such a fantastic feature wont be available in the mainstream mpl colorbar. I don't know the history, but was it, and is it still, entirely necessary to take a fork of the standard colorbar classes? Essentially, what we are seeing is a divergence of functionality (for instance, one class can do inner colorbars, the other can do hatched colorbars - as a user, just pray you don't want both), and an added complexity to the end user about how to produce a colorbar in matplotlib (if you want to do x and y you want this kind of colorbar, but if you want to do z you need this kind of colorbar). Is there any way we can reconcile and factor in the necessary changes from |
bbox_to_anchor = self.get_bbox_to_anchor() | ||
|
||
x0, y0 = self._get_anchored_bbox(self.loc, | ||
bbox, | ||
bbox_to_anchor, | ||
borderpad) | ||
borderpadx, borderpady) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Again, I have readability issues with this. xborderpad
is better, x_border_pad
is best (but most inconsistent with the rest of the code).
@leejjoon : I'm guessing the answer to this is no. If that is the case, then, once @WeatherGod is happy his comments are addressed, I don't see any value in holding this PR up (there is already some awesome functionality in @leejjoon : Are you in a position to move this forwards? Thanks, |
The proposed functionality uses Colorbar class from the matplotlib. But it depends on axes_grid1's functionality to place the colorbar "axes" relative to the parent axes. So, unless axes_grid1 becomes the mainstream part of matplotlib, it is not possible to put this into matplotlib.colorbar.py. In fact, I now think that the current approach is not as good as I originally thought. I have some idea on an alternative (better) approach but not sure when I can start working on. I am not sure what is best option to do with this PR for now. Maybe we put some label on it and close? |
I've added the "onging" label, and will close. Thanks @leejjoon |
Create colorbar at the inner- of outer- side of axes. Unlike the original colorbar command, the location of the original axes is not changed.
See examples/axes_grid/demo_colorbar.py.