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

Skip to content

fix for pcolormesh doesn't allow shading = 'flat' in the option #25058

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 4 commits into from
Jan 24, 2023

Conversation

vivekvedant
Copy link
Contributor

Fix for pcolormesh doesn't allow shading = 'flat' in the option #24678

PR Summary

PR Checklist

Documentation and Tests

  • Has pytest style unit tests (and pytest passes)
  • Documentation is sphinx and numpydoc compliant (the docs should build without error).
  • New plotting related features are documented with examples.

Release Notes

  • New features are marked with a .. versionadded:: directive in the docstring and documented in doc/users/next_whats_new/
  • API changes are marked with a .. versionchanged:: directive in the docstring and documented in doc/api/next_api_changes/
  • Release notes conform with instructions in next_whats_new/README.rst or next_api_changes/README.rst

Copy link

@github-actions github-actions bot left a comment

Choose a reason for hiding this comment

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

Thank you for opening your first PR into Matplotlib!

If you have not heard from us in a while, please feel free to ping @matplotlib/developers or anyone who has commented on the PR. Most of our reviewers are volunteers and sometimes things fall through the cracks.

You can also join us on gitter for real-time discussion.

For details on testing, writing docs, and our review process, please see the developer guide

We strive to be a welcoming and open project. Please follow our Code of Conduct.

@rcomer rcomer linked an issue Jan 22, 2023 that may be closed by this pull request
@vivekvedant vivekvedant reopened this Jan 22, 2023
@melissawm
Copy link
Member

Hi @vivekvedant - thanks for the PR! It looks like you have a couple of linting errors (you can see them here https://github.com/matplotlib/matplotlib/actions/runs/3980860096/jobs/6824208412 or clicking on "Details" on the Linting/flake8 job.) This does not block a review of your PR but if you have the time it would be nice to fix them 😄 Otherwise, now we wait for a maintainer to review your code. Thanks!

' X (%d) and/or Y (%d); see help(%s)' % (
C.shape, Nx, Ny, funcname))
raise TypeError(f"Dimensions of X({Nx}) and y({Ny}) should"
f"be one larger than C{C.shape}"
Copy link
Member

Choose a reason for hiding this comment

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

This error should probably say something about shading='flat', because it is possible to pass x and y the same shape as C for shading='auto' and shading='nearest'. See https://matplotlib.org/stable/gallery/images_contours_and_fields/pcolormesh_grids.html for a discussion.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@jklymak Sir, Updated the error message

raise TypeError('Dimensions of C %s are incompatible with'
' X (%d) and/or Y (%d); see help(%s)' % (
C.shape, Nx, Ny, funcname))
raise TypeError(f"Dimensions of X({Nx}) and y({Ny}) should"
Copy link
Member

Choose a reason for hiding this comment

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

Y should be capitalized. Suggest "Relevant" because X and Y can be 2-D.... Otherwise this looks good to me...

Suggested change
raise TypeError(f"Dimensions of X({Nx}) and y({Ny}) should"
raise TypeError(f"Relevant dimensions of X({Nx}) and Y({Ny}) should"

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Ok Sir, Thank you for the suggestion

@ksunden
Copy link
Member

ksunden commented Jan 23, 2023

lib/matplotlib/tests/test_axes.py::test_pcolorflaterror

Test failure is a consequence of this change, specifically that the older error message pattern is being matched in the test.

@vivekvedant
Copy link
Contributor Author

Ok @ksunden Sir, Thanks for the insights I will recommit the changes to solve this issue

@vivekvedant
Copy link
Contributor Author

@jklymak Sir, I have updated the error message and also fix the issue related to Test failure

@vivekvedant vivekvedant requested a review from jklymak January 24, 2023 14:53
@dstansby dstansby added this to the v3.7.0 milestone Jan 24, 2023
Copy link
Member

@dstansby dstansby left a comment

Choose a reason for hiding this comment

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

Thanks a lot for the PR - looks great to me! 👍

@jklymak jklymak merged commit 0ec308d into matplotlib:main Jan 24, 2023
@jklymak
Copy link
Member

jklymak commented Jan 24, 2023

Thanks @vivekvedant and congratulations on your first Matplotlib PR. We hope to see you again...

meeseeksmachine pushed a commit to meeseeksmachine/matplotlib that referenced this pull request Jan 24, 2023
rcomer added a commit that referenced this pull request Jan 24, 2023
…058-on-v3.7.x

Backport PR #25058 on branch v3.7.x (fix for pcolormesh doesn't allow shading = 'flat' in the option)
@ksunden ksunden mentioned this pull request Feb 20, 2023
6 tasks
@vivekvedant vivekvedant deleted the fix-pcolormesh-issue branch December 11, 2023 05:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Development

Successfully merging this pull request may close these issues.

[Bug]: pcolormesh doesn't allow shading = 'flat' in the option
5 participants