Conversation
| """ | ||
| kwargs = cbook.normalize_kwargs(kwargs, mpatches._patch_alias_map) | ||
|
|
||
| matchers = [ |
There was a problem hiding this comment.
why not just
matchers = [
lambda x, height, width=0.8, bottom=None, **kwargs:
(False, x, height, width, bottom, kwargs),
lambda left, height, width=0.8, bottom=None, **kwargs:
(False, left, height, width, bottom, kwargs),
]
?
or did I miss a case?
lib/matplotlib/axes/_axes.py
Outdated
| Make a bar plot with rectangles bounded by: | ||
|
|
||
| `left`, `left` + `width`, `bottom`, `bottom` + `height` | ||
| `x` - width/2, `x` + `width`/2, `bottom`, `bottom` + `height` |
There was a problem hiding this comment.
These should be changed to use double backquotes around each complete expression.
| error_kw["label"] = '_nolegend_' | ||
|
|
||
| errorbar = self.errorbar(x, y, | ||
| errorbar = self.errorbar(ex, ey, |
There was a problem hiding this comment.
just above (line 2183) can be switched to use setdefault.
| barh(bottom, width, *, align='center', **kwargs) | ||
|
|
||
| despite behaving as the center in both cases. The methods now take ``*args, **kwargs`` | ||
| is input and are documented to have the primary signatures of :: |
lib/matplotlib/axes/_axes.py
Outdated
| else: | ||
| break | ||
| else: | ||
| raise TypeError("Missing two required positional arguments: 'x'" |
There was a problem hiding this comment.
Can you save the first exception and just reraise it here? this will make the message correct in more cases (e.g. the user passes height as a kwarg but not x).
There was a problem hiding this comment.
The first one won't be right, it is the 4th one we want, but if you put the 4th one first it will hit and then we would have to handle the kwargs for the two optional ones seperatly (which might be better).
|
I think I addressed all of @anntzer 's comments, tests are in-progress. |
lib/matplotlib/axes/_axes.py
Outdated
| "ecolor"], | ||
| label_namer=None) | ||
| label_namer=None, | ||
| positional_parameter_names=['x', |
There was a problem hiding this comment.
Why do we need this? (I'ml not too familiar with the exact semantics of _preprocess_data, but at least y looks a bit fishy in the argument list here)
There was a problem hiding this comment.
the 'y' is junk from a second rename that I ended up walking back. The purpose of this list is to tell the pre-processor the name of input hidden in the '*args' so it know which entries to try and look up in data, however in this case we want to do all of them so there is a simpler way.
lib/matplotlib/axes/_axes.py
Outdated
| # size width and bottom according to length of left | ||
| if _bottom is None: | ||
| # size width and y according to length of x | ||
| if _y is None: |
There was a problem hiding this comment.
Can we just default bottom to 0 instead of None? (looks so, except possibly for log scale?)
There was a problem hiding this comment.
we would have to keep this logic anyway as users can be passing None in explicitly. Inclined to let that stay as-is for now.
There was a problem hiding this comment.
Can we at least make the change go before the call to np.broadcast_arrays, so that you don't have to call zeros_like below?
(I would also deprecate allowing passing None yada yada)
Change the documented first position argument to x and y for bar and barh respectively but still support passing in left and bottom as keyword arguments. closes matplotlib#7954 closes matplotlib#8327 closes matplotlib#8527 closes matplotlib#8882
This change is from matplotlib#8993
1ee0351 to
5bb1c8a
Compare
|
CI failing with some docstring markup. |
dopplershift
left a comment
There was a problem hiding this comment.
A few minor things, but otherwise it's a 👍 from me.
|
|
||
| patches = self.bar(left=left, height=height, width=width, | ||
| bottom=bottom, orientation='horizontal', **kwargs) | ||
| matchers = [ |
There was a problem hiding this comment.
A comment explaining what the lambdas are for wouldn't hurt.
PR Summary
Adjusts the signature of
barandbarhcloses #7954
closes #8327
closes #8527
closes #8882
PR Checklist
I'll add specific tests later tonight, but the existing test do a pretty good job of covering these changes.