Skip to content

clarify example in plot docstring #18700

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 10, 2020
Merged

Conversation

ianhi
Copy link
Contributor

@ianhi ianhi commented Oct 9, 2020

PR Summary

This example from the plot docstring was unclear and/or incorrect. This modifies in a way that I at least find clearer.

import numpy as np
import matplotlib.pyplot as plt

fig, (ax1, ax2, ax3) = plt.subplots(1,3, sharey=True, figsize=(10,5))
a = np.arange(6).reshape(3,2)
ax1.plot(a[0], a[1:], 'o-') #old example
ax2.plot(a, 'o-')
for i in range(2):
    ax3.plot(a[:, i], 'o-')
ax1.set_title('Old Example')
ax2.set_title('New Example - part 1')
ax3.set_title('New Example - part 2')
ax1.set_xlim(ax3.get_xlim())

image

See discussion on gitter starting here: https://gitter.im/matplotlib/matplotlib?at=5f80c4dfdc95072254c78916

PR Checklist

  • [N/A] Has pytest style unit tests (and pytest passes).
  • [N/A] Is Flake 8 compliant (run flake8 on changed files to check).
  • [N/A] New features are documented, with examples if plot related.
  • (as yet undetermined, allowing CI to build) Documentation is sphinx and numpydoc compliant (the docs should build without error).
  • Conforms to Matplotlib style conventions (install flake8-docstrings and pydocstyle<4 and run flake8 --docstring-convention=all).
  • [N/A] New features have an entry in doc/users/next_whats_new/ (follow instructions in README.rst there).
  • [N/A] API changes documented in doc/api/next_api_changes/ (follow instructions in README.rst there).

@jklymak jklymak modified the milestones: v3.4.0, v3.3-doc Oct 10, 2020
@jklymak
Copy link
Member

jklymak commented Oct 10, 2020

Suggest back porting, because the previous docstring was incorrect (so far as I understand it)

@jklymak jklymak merged commit 4b244a7 into matplotlib:master Oct 10, 2020
meeseeksmachine pushed a commit to meeseeksmachine/matplotlib that referenced this pull request Oct 10, 2020
@ianhi ianhi deleted the plot-docstring branch October 10, 2020 04:34
QuLogic added a commit that referenced this pull request Oct 10, 2020
…700-on-v3.3.2-doc

Backport PR #18700 on branch v3.3.2-doc (clarify example in plot docstring)
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.

3 participants