Skip to content

Doc: examples update #13399

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

Conversation

ImportanceOfBeingErnest
Copy link
Member

PR Summary

Update 3 examples:

Barchart example

In #12244 the Barchart example got removed from the "Lines, Bars, and Markers" gallery section. However, a bar chart example should be in the section named "Bars". It is also one of the most frequent questions on stackoverflow on how to label bars. Links to the example should not be broken. Inside this example, the coordinates of the labels should be placed at an offset from the bar tip in absolute units, instead of data units, such that people will not struggle to apply the example to their very different data ranges.

I also corrected the coordinate placement in the statistics example the bar example got merged with and changed the random state, such that some of the stylings used in that example actually take effect. In total, I'm not convinced that this example is actually needed, or maybe better shown in the showcase section? That is in any case beyond this PR.

Polar bar chart example

This example was wrongly named. Also it used a loop to set colors, which is unnecessary.

Image interpolation example

Change the figure size to let it fit into the webpage and remove a redundant line.

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

@ImportanceOfBeingErnest ImportanceOfBeingErnest added this to the v3.0-doc milestone Feb 10, 2019
@ImportanceOfBeingErnest ImportanceOfBeingErnest force-pushed the doc-examples-cleanup branch 3 times, most recently from 1dc89a6 to d8a80c6 Compare February 10, 2019 18:09
@NelleV
Copy link
Member

NelleV commented Feb 10, 2019

Can we remove the one in units? We have more than 500 examples: we should aim at reducing this number. It's one of the reasons why users struggle with finding examples matching what they want in the gallery.

@NelleV
Copy link
Member

NelleV commented Feb 10, 2019

(I agree that the example in question makes way more sense in lines, bars, and markers)

@ImportanceOfBeingErnest
Copy link
Member Author

I think it's pretty cool to have the units explained by drawing the parallel to an existing example. This allows to grasp how it works.

However, I'd agree that some of the unit examples could be merged into one longer example with more code sections. Because either you dive into this stuff, then you can read everything in one page; or not, then it's easier to ignore a lower number of examples.

If you want to remove an example I'd vote for the one that this PR disentangles (the one with Johnny Doe's sports performance) from the canonical grouped bar chart example, because it is long, and essentially only shows a real world use case someone may have had a couple of years ago.

@ImportanceOfBeingErnest ImportanceOfBeingErnest force-pushed the doc-examples-cleanup branch 2 times, most recently from c1c0f30 to b893006 Compare February 10, 2019 20:31
with error bars. This example shows a ways to create a grouped bar chart
with Matplotlib and also how to annotate bars with labels.

Credit: Josh Hemann
Copy link
Member

Choose a reason for hiding this comment

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

I would drop the credit...

Copy link
Member Author

Choose a reason for hiding this comment

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

Ok, done, though I'm not sure about the general policy.

@@ -0,0 +1,78 @@
"""
============================
Grouped Barchart with labels
Copy link
Contributor

Choose a reason for hiding this comment

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

"bar chart" (two words, uncapitalized)

Copy link
Member

@timhoffm timhoffm left a comment

Choose a reason for hiding this comment

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

Semi-OT: ax2.set_xlabel(('Percentile Ranking Across ' in barchart_demo.py does not show up in the plot
https://535-100939689-gh.circle-artifacts.com/0/home/circleci/project/doc/build/html/gallery/statistics/barchart_demo.html#sphx-glr-gallery-statistics-barchart-demo-py

Maybe because ax2 is a twinned axes?

@ImportanceOfBeingErnest
Copy link
Member Author

Already in 1.3.1 this label did not appear, so maybe it actually never did. In any case I corrected it.

@timhoffm timhoffm merged commit 9f0afd2 into matplotlib:master Feb 14, 2019
@lumberbot-app
Copy link

lumberbot-app bot commented Feb 14, 2019

Owee, I'm MrMeeseeks, Look at me.

There seem to be a conflict, please backport manually. Here are approximate instructions:

  1. Checkout backport branch and update it.
$ git checkout v3.0.x
$ git pull
  1. Cherry pick the first parent branch of the this PR on top of the older branch:
$ git cherry-pick -m1 9f0afd2d17380166591a927e512983767182ddbb
  1. You will likely have some merge/cherry-pick conflict here, fix them and commit:
$ git commit -am 'Backport PR #13399: Doc: examples update'
  1. Push to a named branch :
git push YOURFORK v3.0.x:auto-backport-of-pr-13399-on-v3.0.x
  1. Create a PR against branch v3.0.x, I would have named this PR:

"Backport PR #13399 on branch v3.0.x"

And apply the correct labels and milestones.

Congratulation you did some good work ! Hopefully your backport PR will be tested by the continuous integration and merged soon!

If these instruction are inaccurate, feel free to suggest an improvement.

@lumberbot-app
Copy link

lumberbot-app bot commented Feb 14, 2019

Owee, I'm MrMeeseeks, Look at me.

There seem to be a conflict, please backport manually. Here are approximate instructions:

  1. Checkout backport branch and update it.
$ git checkout v3.0.2-doc
$ git pull
  1. Cherry pick the first parent branch of the this PR on top of the older branch:
$ git cherry-pick -m1 9f0afd2d17380166591a927e512983767182ddbb
  1. You will likely have some merge/cherry-pick conflict here, fix them and commit:
$ git commit -am 'Backport PR #13399: Doc: examples update'
  1. Push to a named branch :
git push YOURFORK v3.0.2-doc:auto-backport-of-pr-13399-on-v3.0.2-doc
  1. Create a PR against branch v3.0.2-doc, I would have named this PR:

"Backport PR #13399 on branch v3.0.2-doc"

And apply the correct labels and milestones.

Congratulation you did some good work ! Hopefully your backport PR will be tested by the continuous integration and merged soon!

If these instruction are inaccurate, feel free to suggest an improvement.

@jklymak
Copy link
Member

jklymak commented Feb 14, 2019

I think the back port is pretty optional here...

@QuLogic
Copy link
Member

QuLogic commented Feb 14, 2019

Probably not necessary since we're going to release pretty soon.

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.

7 participants