-
Notifications
You must be signed in to change notification settings - Fork 2
feat: Add Plotly as backend #378
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
Conversation
|
This looks really cool - I will try to review this tomorrow |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks pretty neat @AlejandroFernandezLuces -- I'd love to see more functionalities get added to it but as a starting point it's really good
Have we tried it with a library directly and see how it plays?
src/ansys/tools/visualization_interface/backends/plotly/plotly_interface.py
Outdated
Show resolved
Hide resolved
src/ansys/tools/visualization_interface/backends/plotly/plotly_interface.py
Outdated
Show resolved
Hide resolved
src/ansys/tools/visualization_interface/backends/plotly/plotly_interface.py
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM! Nice job @AlejandroFernandezLuces
Overview
Add Plotly as backend. I added a simple example to show how to use Plotly as a backend with the plotter. Minor changes to the BaseBackend class were needed, since I didn't realize some issues until the new backend was added.
Endless features can be added to this backend, so for the moment let's add the basics and we can check what we need to add in further iterations. For the moment, it allows to plot PyVista meshes, MeshObjectPlot objects and Plotly objects. Later we can add the button/picking features from the PyVista backend or even other features that plotly allows.
Layout object from Plotly is exposed through a property to allow uses to customize it as they want. As you can see in their docs, customization is pretty extensive: https://plotly.com/python-api-reference/generated/plotly.graph_objects.Layout.html
Also, I had to implement a simple image comparison for testing Plotly plot outputs, which seems to be working fine from what I see in the image cache.
pytest-pyvistais not compatible with Plotly.Example
This is what the included example looks like:
Recording.2025-10-08.164706.mp4