Skip to content
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

ToroidalVoxelGrid.plot() raises a TypeError with Matplotlib 3.8 #422

Closed
vsnever opened this issue Oct 27, 2023 · 3 comments · Fixed by #423
Closed

ToroidalVoxelGrid.plot() raises a TypeError with Matplotlib 3.8 #422

vsnever opened this issue Oct 27, 2023 · 3 comments · Fixed by #423
Assignees
Labels

Comments

@vsnever
Copy link
Member

vsnever commented Oct 27, 2023

Passing the closed parameter to Polygon.__init__() positionally, like here:

for voxel in self:
polygon = Polygon([(v.x, v.y) for v in voxel.vertices], True)
patches.append(polygon)

was deprecated in Matplotlib 3.6 and in Matplotlib 3.8 raises a TypeError.

@Mateasek
Copy link
Member

The issues we are getting because of Matplotlib are getting quite annoying. Generally I think that the classes should not have plotting methods. A better approach in my opinion is to plot in functions external to cherab classes, which access the class data. What do you think? I know that changing this now would break backwards compatibility, but if the suggested approach is accepted, we can have it as a milestone for the next major version of Cherab.

@vsnever
Copy link
Member Author

vsnever commented Oct 27, 2023

The issues we are getting because of Matplotlib are getting quite annoying. Generally I think that the classes should not have plotting methods. A better approach in my opinion is to plot in functions external to cherab classes, which access the class data. What do you think? I know that changing this now would break backwards compatibility, but if the suggested approach is accepted, we can have it as a milestone for the next major version of Cherab.

I agree, this will also help improve class design by ensuring that if a protected/private attribute is used for plotting, it should be available as a property.

In addition to ToroidalVoxelGrid the plotting method is also present in the _PECRate class, where it definitely shouldn’t be. We also have plotting methods in the mesh classes in cherab-solps, cherab-edge2d and cherab-imas.

For now, I'll just merge the fix from #423 so the tests can be passed.

@vsnever
Copy link
Member Author

vsnever commented Dec 1, 2023

Fixed in #423.

@vsnever vsnever closed this as completed Dec 1, 2023
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 a pull request may close this issue.

2 participants