Skip to content

Conversation

@AlejandroFernandezLuces
Copy link
Collaborator

@AlejandroFernandezLuces AlejandroFernandezLuces commented Oct 8, 2025

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-pyvista is not compatible with Plotly.

Example

This is what the included example looks like:

Recording.2025-10-08.164706.mp4

@AlejandroFernandezLuces AlejandroFernandezLuces changed the title Feat/plotly feat: Add Plotly as backend Oct 8, 2025
@github-actions github-actions bot added maintenance Package and maintenance related testing Anything related to testing enhancement New features or code improvements labels Oct 8, 2025
@AlejandroFernandezLuces AlejandroFernandezLuces marked this pull request as ready for review October 8, 2025 14:31
@RobPasMue
Copy link
Member

This looks really cool - I will try to review this tomorrow

Copy link
Member

@RobPasMue RobPasMue left a 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?

Copy link
Member

@RobPasMue RobPasMue left a 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

@AlejandroFernandezLuces AlejandroFernandezLuces merged commit a219be2 into main Oct 10, 2025
23 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New features or code improvements maintenance Package and maintenance related testing Anything related to testing

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants