Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Allow users to control the fill for AnchoredSizeBar #8835

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

Merged
merged 2 commits into from
Jul 7, 2017

Conversation

ngoldbaum
Copy link
Contributor

@ngoldbaum ngoldbaum commented Jul 3, 2017

PR Summary

Currently it's only possible to control the fill property for the Rectangle patch created by the AnchoredSizeBar by doing something like:

bar = AnchoredSizeBar(...)
bar.size_bar._children[0].set_fill(True)

This is very non-obvious and as far as I can tell can only be accomplished by manipulating the private _children attribute.

What this does

This PR adds a new keyword argument to the AnchoredSizeBar initializer that allows users to control the fill keyword argument passed to the Rectangle patch, making it possible to easily create filled size bars.

Copy link
Member

@dstansby dstansby left a comment

Choose a reason for hiding this comment

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

Looks good to me! Is there any reason not to call the kwarg fill instead of fill_bar?

@ngoldbaum
Copy link
Contributor Author

ngoldbaum commented Jul 4, 2017

To distinguish between the bar and the fill for the whole size bar, including the label and frame.

@tacaswell
Copy link
Member

This is an almost identical change to #8829

50/50 on fill_bar vs fill.

Should definitely pull the whats_new from #8829 and think about the variable default behavior from #8829 (comment)

@ngoldbaum
Copy link
Contributor Author

Fair enough. @magnunor I'm going to go ahead and implement the suggestion to make the default filling behavior depend on size_vertical.

@tacaswell tacaswell added this to the 2.1 (next point release) milestone Jul 5, 2017
@ngoldbaum
Copy link
Contributor Author

Closing and reopening to trigger another test run.

@ngoldbaum ngoldbaum closed this Jul 6, 2017
@ngoldbaum ngoldbaum reopened this Jul 6, 2017
@magnunor
Copy link
Contributor

magnunor commented Jul 7, 2017

Sounds good! I'll close my pull request.

@tacaswell tacaswell merged commit 2ea1261 into matplotlib:master Jul 7, 2017
@tacaswell
Copy link
Member

Thanks @ngoldbaum and @magnunor ! Two PRs to do the same thing clearly shows there is a need :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants