Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Remove unnecessary calls to np.array in examples. #16430

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
Feb 7, 2020

Conversation

anntzer
Copy link
Contributor

@anntzer anntzer commented Feb 6, 2020

There's many places where explicit conversion to np.array is not necessary
-- because matplotlib or numpy already handles the conversion, or
because the variable is already an array. Removing these calls makes
the examples concentrate more on the plotting-relevant parts.

PR Summary

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

@anntzer anntzer added this to the v3.3.0 milestone Feb 6, 2020
There's many places where explicit conversion to np.array is not necessary
-- because matplotlib or numpy already handles the conversion, or
because the variable is already an array.  Removing these calls makes
the examples concentrate more on the plotting-relevant parts.
@codecov
Copy link

codecov bot commented Feb 7, 2020

Codecov Report

Merging #16430 into master will decrease coverage by 6.00%.
The diff coverage is n/a.

Impacted file tree graph

@@            Coverage Diff             @@
##           master   #16430      +/-   ##
==========================================
- Coverage   80.86%   74.85%   -6.01%     
==========================================
  Files         307      276      -31     
  Lines       75749    68660    -7089     
  Branches     9692     9688       -4     
==========================================
- Hits        61252    51395    -9857     
- Misses      11959    14909    +2950     
+ Partials     2538     2356     -182     
Impacted Files Coverage Δ
lib/matplotlib/backends/backend_gtk3cairo.py 0.00% <0.00%> (-100.00%) ⬇️
...b/matplotlib/backends/qt_editor/formsubplottool.py 0.00% <0.00%> (-100.00%) ⬇️
lib/matplotlib/backends/backend_qt5cairo.py 0.00% <0.00%> (-89.19%) ⬇️
lib/matplotlib/backends/backend_qt4agg.py 20.00% <0.00%> (-80.00%) ⬇️
lib/matplotlib/tests/test_backend_qt.py 14.75% <0.00%> (-78.38%) ⬇️
lib/matplotlib/tests/test_backend_cairo.py 25.00% <0.00%> (-75.00%) ⬇️
lib/matplotlib/tests/test_usetex.py 30.55% <0.00%> (-69.45%) ⬇️
lib/matplotlib/backends/backend_wxcairo.py 0.00% <0.00%> (-64.00%) ⬇️
lib/matplotlib/backends/backend_qt5agg.py 10.63% <0.00%> (-63.83%) ⬇️
lib/matplotlib/backends/backend_pgf.py 19.08% <0.00%> (-61.03%) ⬇️
... and 198 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update b2e6e6d...b5155b7. Read the comment docs.

@@ -30,7 +30,7 @@
])


x, y = np.dot(R, np.array([x, y]))
x, y = np.dot(R, [x, y])
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
x, y = np.dot(R, [x, y])
x, y = R @ [x, y]

Simpler?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I'd rather leave the dot -> @ for another time.

@tacaswell
Copy link
Member

The travis OSX failure looks un-related (failure to read a png back in).

@tacaswell tacaswell merged commit cb904b1 into matplotlib:master Feb 7, 2020
@anntzer anntzer deleted the unarray branch February 7, 2020 16:03
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