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

Api bar signature#9110

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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Merged
efiring merged 7 commits intomatplotlib:masterfromtacaswell:api_bar_signature
Aug 31, 2017
Merged

Conversation

tacaswell
Copy link
Member

@tacaswelltacaswell commentedAug 27, 2017
edited by dopplershift
Loading

PR Summary

Adjusts the signature ofbar andbarh

closes#7954
closes#8327
closes#8527
closes#8882

PR Checklist

  • Has Pytest style unit tests
  • Code is PEP 8 compliant
  • Documentation is sphinx and numpydoc compliant
  • Documented in doc/api/api_changes.rst if API changed in a backward-incompatible way

I'll add specific tests later tonight, but the existing test do a pretty good job of covering these changes.

@tacaswelltacaswell added this to the2.1 (next point release) milestoneAug 27, 2017
@tacaswelltacaswell added the Release criticalFor bugs that make the library unusable (segfaults, incorrect plots, etc) and major regressions. labelAug 27, 2017
"""
kwargs = cbook.normalize_kwargs(kwargs, mpatches._patch_alias_map)

matchers = [
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

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?

Copy link
MemberAuthor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

ah, that is better 🐑


Make a bar plot with rectangles bounded by:

`left`, `left` + `width`, `bottom`, `bottom` + `height`
`x` - width/2, `x` + `width`/2, `bottom`, `bottom` + `height`
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

These should be changed to use double backquotes around each complete expression.


if "label" not in error_kw:
error_kw["label"] = '_nolegend_'

errorbar = self.errorbar(x, y,
errorbar = self.errorbar(ex, ey,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

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 ::
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

no space before ::

else:
break
else:
raise TypeError("Missing two required positional arguments: 'x'"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

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).

Copy link
MemberAuthor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

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).

Copy link
MemberAuthor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

nm

@tacaswell
Copy link
MemberAuthor

I think I addressed all of@anntzer 's comments, tests are in-progress.

"color", "edgecolor", "linewidth",
"tick_label", "xerr", "yerr",
"ecolor"],
label_namer=None)
label_namer=None,
positional_parameter_names=['x',
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

Why do we need this? (I'ml not too familiar with the exact semantics of _preprocess_data, but at leasty looks a bit fishy in the argument list here)

Copy link
MemberAuthor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

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 indata, however in this case we want to do all of them so there is a simpler way.

# size width andbottom according to length ofleft
if_bottom is None:
# size width andy according to length ofx
if_y is None:
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

Can we just default bottom to 0 instead of None? (looks so, except possibly for log scale?)

Copy link
MemberAuthor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

we would have to keep this logic anyway as users can be passingNone in explicitly. Inclined to let that stay as-is for now.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

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 forbar and barh respectively but still support passing in left and bottomas keyword arguments.closesmatplotlib#7954closesmatplotlib#8327closesmatplotlib#8527closesmatplotlib#8882
@anntzer
Copy link
Contributor

CI failing with some docstring markup.

Copy link
Contributor

@dopplershiftdopplershift left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

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 = [
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

A comment explaining what the lambdas are for wouldn't hurt.

@efiringefiring merged commit6c69f3e intomatplotlib:masterAug 31, 2017
@tacaswelltacaswell deleted the api_bar_signature branchAugust 31, 2017 02:14
@anntzeranntzer mentioned this pull requestSep 10, 2017
Closed
Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment
Reviewers

@anntzeranntzeranntzer left review comments

@dopplershiftdopplershiftdopplershift approved these changes

Assignees
No one assigned
Labels
Release criticalFor bugs that make the library unusable (segfaults, incorrect plots, etc) and major regressions.
Projects
None yet
Milestone
v2.1
4 participants
@tacaswell@anntzer@dopplershift@efiring

[8]ページ先頭

©2009-2025 Movatter.jp