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

Skip to content

Simplify radar_chart example. #12492

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 1 commit into from
Oct 12, 2018
Merged

Simplify radar_chart example. #12492

merged 1 commit into from
Oct 12, 2018

Conversation

anntzer
Copy link
Contributor

@anntzer anntzer commented Oct 11, 2018

... by reusing already existing utilities to generate regular polygons.

PR Summary

PR Checklist

  • Has Pytest style unit tests
  • Code is Flake 8 compliant
  • New features are documented, with examples if plot related
  • Documentation is sphinx and numpydoc compliant
  • Added an entry to doc/users/next_whats_new/ if major new feature (follow instructions in README.rst there)
  • Documented in doc/api/api_changes.rst if API changed in a backward-incompatible way

# rotate theta such that the first axis is at the top
verts = unit_poly_verts(theta + np.pi / 2)
return plt.Polygon(verts, closed=True, edgecolor='k')
return RegularPolygon((0.5, 0.5), num_vars, radius=.5, edgecolor="k")

def draw_circle_patch(self):
Copy link
Member

Choose a reason for hiding this comment

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

Since draw_poly_patch and dras_circle_patch just return simple patches now, you can simplify all the overhead and create the appropriate patch directly in _gen_axes_patch.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

sounds good, done

@ImportanceOfBeingErnest
Copy link
Member

Simplifying this example has the potential to invite more users to actually understand it, instead of just copying it for their purposes. This is a good thing, apart from the natural advantage of having less code lines. I don't think it becomes too compact, since the main ingrediences stay the same.

Is there any reason for no tests being run on this PR?

@anntzer
Copy link
Contributor Author

anntzer commented Oct 11, 2018

It's run as part of the doc build.
I wouldn't want to add it to the test suite unless you think it's testing a specific feature that's not test-covered yet -- the test suite is already slow enough as it is.

invite more users to actually understand it
apart from the natural advantage of having less code lines

You know, I'm not deleting lines just because I find this fun...

@ImportanceOfBeingErnest
Copy link
Member

Sorry, that wasn't clear from my side. I'm not asking for a test for this, nor for the functionality be tested within the tests outside of the circle-ci doc builds (which I think are sufficient).
What I meant instead is that I do not see the tests being run at all. This is what I see here:

image

However I would expect to see something like the following:

image

@anntzer
Copy link
Contributor Author

anntzer commented Oct 11, 2018

Uh, good point. Dunno what's happening.

Copy link
Member

@QuLogic QuLogic left a comment

Choose a reason for hiding this comment

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

Need to figure out why tests didn't run; might just work if you push a new commit.

spine_type='circle',
path=Path.unit_regular_polygon(num_vars))
# unit_regular_polygon gives a polygon of radius 1 centered at
# (0, 0) but we want a polygon of radius 0.5 centerer at (0.5, 0.5)
Copy link
Member

Choose a reason for hiding this comment

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

s/centerer/centred/

... by reusing already existing utilities to generate regular polygons.
@anntzer
Copy link
Contributor Author

anntzer commented Oct 12, 2018

Repushed, CI seems to be running.
I also decided to remove the comment mentioning _gen_axes_spines as a "hack", as it's documented behavior and not more a "hack" than _gen_axes_patch (I think).

@anntzer
Copy link
Contributor Author

anntzer commented Oct 12, 2018

Test failure is due to travis flakiness.

@QuLogic QuLogic merged commit 2d2d3e5 into matplotlib:master Oct 12, 2018
@QuLogic QuLogic added this to the v3.1 milestone Oct 12, 2018
@anntzer anntzer deleted the radar branch October 13, 2018 10:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants