Skip to content

Cleanup plot types#20509

Merged
QuLogic merged 1 commit into
matplotlib:masterfrom
timhoffm:doc-plot-types-clean
Jun 29, 2021
Merged

Cleanup plot types#20509
QuLogic merged 1 commit into
matplotlib:masterfrom
timhoffm:doc-plot-types-clean

Conversation

@timhoffm
Copy link
Copy Markdown
Member

PR Summary

Some simplifications and more standard code style.

@timhoffm timhoffm added this to the v3.5.0 milestone Jun 24, 2021
Comment thread plot_types/stats/barbs.py
Y = [[1.5, 3, 2]]
U = -np.ones((1, 3)) * 0
V = -np.ones((1, 3)) * np.linspace(50, 100, 3)
U = np.zeros_like(X)
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

This was made lowercase everywhere else. Why uppercase here?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

I mostly follow the capitalization in the signature of the respective plot function, some of which are lowercase, some are uppercase.

There's a loose convention that 1D arrays have regular lowercase names and 2D arrays from np.meshgrid() have uppercase names (e.g. X, Y = np.meshgrid(x, y)). I suspect that the signature roughly follows this pattern: If we expect 2D input, we use an uppercase parameter name. For barbs this is a bit ambiguous as parameters can be 1D or 2D, so I followed the signature style.

Comment thread plot_types/basic/scatter_plot.py Outdated
y = 4 + np.random.normal(0, 2, len(x))
# size and color:
S = np.random.uniform(15, 80, len(X))
S = np.random.uniform(15, 80, len(x))
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Why is this not lowercased? Or maybe rename to sizes.

Comment thread plot_types/stats/barbs.py
Comment on lines 15 to +18
X = [[2, 4, 6]]
Y = [[1.5, 3, 2]]
U = -np.ones((1, 3)) * 0
V = -np.ones((1, 3)) * np.linspace(50, 100, 3)
U = np.zeros_like(X)
V = -np.ones_like(X) * np.linspace(50, 100, 3)
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Lower case?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

See comment in #20509 (review)

@QuLogic
Copy link
Copy Markdown
Member

QuLogic commented Jun 25, 2021

I'm not sure that message is what you meant to put in that last commit.

@timhoffm timhoffm force-pushed the doc-plot-types-clean branch from 3d81ba0 to 6b84212 Compare June 27, 2021 11:19
@timhoffm
Copy link
Copy Markdown
Member Author

Squashed.

@QuLogic QuLogic merged commit dab3974 into matplotlib:master Jun 29, 2021
@timhoffm timhoffm deleted the doc-plot-types-clean branch June 29, 2021 19:20
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