Skip to content

DOC : Improves Documentation for stem_plot.py #11677

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
Jul 19, 2018
Merged

DOC : Improves Documentation for stem_plot.py #11677

merged 1 commit into from
Jul 19, 2018

Conversation

gabru-md
Copy link
Contributor

@gabru-md gabru-md commented Jul 17, 2018

PR Summary

This Pull Request improves the documentation of the stem_plot.py example.
Adds enough information in the example file for the user to understand every step.

😸

PR Checklist

  • Has Pytest style unit tests
  • Code is PEP 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

@gabru-md
Copy link
Contributor Author

@story645 can you give a review please 😃

@ImportanceOfBeingErnest
Copy link
Member

ImportanceOfBeingErnest commented Jul 17, 2018

This is an effort in view of #11654. I guess this can be merged as is.

Just a general note: Wouldn't it make sense to write the explanation as text above the example and only use very short comments inside the code?

x = np.linspace(0.1, 2 * np.pi, 10)

"""
Copy link
Member

Choose a reason for hiding this comment

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

Thanks for the PR! This should go in the first comment, not inside the code.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

okay! I will make the changes. 😃
I'll add this below Example stem plot. Is that okay?

Copy link
Member

Choose a reason for hiding this comment

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

Yes, that'd be great.

Could you also add something like:

#############################
# This example makes use of:
# * :meth:`matplotlib.axes.Axes.stem`

At the bottom of the example? This will make a backlink to .Axes.stem that will then make a thumbnail of this example show up at: https://matplotlib.org/api/_as_gen/matplotlib.axes.Axes.stem.html

Copy link
Contributor Author

Choose a reason for hiding this comment

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

sure!
will just add this at the end 👍 and update the PR

@jklymak
Copy link
Member

jklymak commented Jul 17, 2018

@gabru-md You'll have to drill down the ci/circleci Details above to see what didn't work in your doc build...

@jklymak jklymak added this to the v2.2-doc milestone Jul 17, 2018
plt.setp(baseline, color='r', linewidth=2)

# displaying the plot
Copy link
Member

Choose a reason for hiding this comment

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

I think you don't need this comment.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

will remove this 👍

@@ -4,12 +4,28 @@
=========

Example stem plot.
Copy link
Member

Choose a reason for hiding this comment

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

note sure this line is helpful for explaining what's going on.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

will clear this out 👍

@@ -4,12 +4,28 @@
=========

Example stem plot.
Stem plot plots vertical lines from baseline to the y-coordinate
Copy link
Member

Choose a reason for hiding this comment

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

I think this is awesome. So awesome in fact that I don't think you need the returns section.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

It was mentioned in the issue

For example, in the stem plot example below it is unclear what markerline, stemlines, and
baseline are relative the plot, and why plt.stem returns those three objects and what the plt.setp 
function is doing.

Therefore I added the return section in the docs.
Incase, you want then I can remove them 👍

Copy link
Member

Choose a reason for hiding this comment

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

Yeah, but I think you've now explained it so well in the blurb that you don't explicitly need the return.

@gabru-md
Copy link
Contributor Author

gabru-md commented Jul 19, 2018

@story645 can you please tell me how is the coverage being affected ?
I cannot wrap my head around this. 😅

@@ -3,13 +3,23 @@
Stem Plot
=========

Example stem plot.
Stem plot plots vertical lines from baseline to the y-coordinate
Plotting cosine(x) w.r.t x, using '-.' as the pattern
Copy link
Member

Choose a reason for hiding this comment

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

i prefer writing out "with respect to", but that's not a deal breaker.

@jklymak
Copy link
Member

jklymak commented Jul 19, 2018

Well, I was hoping to check CI, but its being flakey. The source looks fine, so I'll merge as is. If there are any bad mistakes we can fix after.

Thanks a lot for the PR!

@jklymak jklymak merged commit b8838c3 into matplotlib:master Jul 19, 2018
jklymak added a commit that referenced this pull request Jul 19, 2018
…677-on-v2.2.2-doc

Backport PR #11677 on branch v2.2.2-doc
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