Skip to content

DOC: Add plotting examples and fix broken examples #33989

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

deppen8
Copy link
Contributor

@deppen8 deppen8 commented May 5, 2020

This PR improves the pandas.plotting._misc.py module docs by:

  1. Adding example plots where they were missing from docstrings.
  2. Fixing examples that were not formatted to render with
.. plot::
    :context: close-figs
  1. Simplifying the syntax of some oddly-written examples.

In some cases, I replicated the examples found in the User Guide.

@pep8speaks
Copy link

pep8speaks commented May 5, 2020

Hello @deppen8! Thanks for updating this PR. We checked the lines you've touched for PEP 8 issues, and found:

There are currently no PEP 8 issues detected in this Pull Request. Cheers! 🍻

Comment last updated at 2020-05-05 21:05:27 UTC

@datapythonista
Copy link
Member

Thanks @deppen8, cool stuff. Did you render the website to see that everything is looking as expected?

@jorisvandenbossche, may be you want to have a look here.

Copy link
Member

@jorisvandenbossche jorisvandenbossche left a comment

Choose a reason for hiding this comment

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

Thanks! Looks good generally, just wondering: are the random seeds necessary? We don't really do this in other parts of docs, I think.


>>> s = pd.Series(np.random.uniform(size=100))
>>> fig = pd.plotting.bootstrap_plot(s) # doctest: +SKIP
>>> np.random.seed(5)
Copy link
Member

Choose a reason for hiding this comment

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

is this seed needed?

@deppen8
Copy link
Contributor Author

deppen8 commented May 5, 2020

@datapythonista, I built the docs locally and nothing looked out of order.

@jorisvandenbossche I found this advice which suggested using random seeds.

https://pandas.pydata.org/docs/development/contributing_docstring.html#tips-for-getting-your-examples-pass-the-doctests

In the case of the lag plot, it has an added benefit of keeping the demo data above zero, which probably matches most use cases better.

@jreback jreback added this to the 1.1 milestone May 5, 2020
@jorisvandenbossche
Copy link
Member

I found this advice which suggested using random seeds.

Ah, yes, but that's only to get doctests passing where eg a number is shown in the output, while here the plots are not actually checked.

For the lag plot that sounds like a good reason, for the others I would maybe remove it again, if we don't do that elsewhere

@deppen8
Copy link
Contributor Author

deppen8 commented May 5, 2020

For the lag plot that sounds like a good reason, for the others I would maybe remove it again, if we don't do that elsewhere

Done!

@jorisvandenbossche jorisvandenbossche merged commit 18a7e97 into pandas-dev:master May 6, 2020
@jorisvandenbossche
Copy link
Member

Thanks @deppen8 !

rhshadrach pushed a commit to rhshadrach/pandas that referenced this pull request May 10, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants