Skip to content

generate deterministic IDs for SVG elements to facilitate diff #1968

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

Open
gvwilson opened this issue Dec 4, 2019 · 8 comments
Open

generate deterministic IDs for SVG elements to facilitate diff #1968

gvwilson opened this issue Dec 4, 2019 · 8 comments
Labels
feature something new P3 backlog

Comments

@gvwilson
Copy link
Contributor

gvwilson commented Dec 4, 2019

When saving figure as SVG using write_image, Plotly Express generates random unique IDs for elements. As a result, git diff thinks re-generated figures have changed even when they haven't (see screenshot). If the IDs were generated in some deterministic way depending solely on figure contents, so that they only changed when the figure itself had visually changed, git would be a lot happier.
Screen Shot 2019-12-04 at 11 14 33 AM

see #3393

@nicolaskruchten
Copy link
Contributor

Thanks for creating this issue! This is something we've discussed internally with no real resolution so far... Plotly.py delegates to https://github.com/plotly/orca for SVG-generation, so we would need an Orca flag to modulate this behaviour or at least fix the random seed that it uses or something.

Heads-up @antoinerg :)

@emmanuelle
Copy link
Contributor

Great to see you here @gvwilson ! ;-) Would love to know more about how you're using plotly.py one of these days!

@gvwilson
Copy link
Contributor Author

gvwilson commented Dec 4, 2019

Thanks - I'm regenerating a lot of figures for lessons using command-line scripts and getting a linearly-increasing number of spurious diffs because of this.

@gvwilson
Copy link
Contributor Author

gvwilson commented Dec 4, 2019

@emmanuelle I'm trying to re-learn some basic statistics, mostly out of shame :-)

@emmanuelle
Copy link
Contributor

Well at least it's RE-learning for you :-).

@gvwilson
Copy link
Contributor Author

gvwilson commented Dec 4, 2019

You'd be amazed how much math someone can forget in (checks) 37 years.

@antoinerg
Copy link
Contributor

antoinerg commented Dec 4, 2019

I agree that generating deterministic IDs should absolutely be a feature. If it requires work on Orca, I would gladly undertake it myself. However, I think it might be better to implement this directly in plotly.js. If I'm not mistaken, there might already an issue for this in https://github.com/plotly/plotly.js but I can't seem to find it at the moment (@etpinard can you point me to it?).

@etpinard
Copy link
Contributor

etpinard commented Dec 4, 2019

Here -> plotly/orca#133

@gvwilson gvwilson self-assigned this Jun 14, 2024
@gvwilson gvwilson assigned gvwilson and unassigned gvwilson Aug 2, 2024
@gvwilson gvwilson added the feature something new label Aug 2, 2024
@gvwilson gvwilson added the P3 backlog label Aug 12, 2024
@gvwilson gvwilson changed the title feature request: generate deterministic IDs for SVG elements to facilitate diff generate deterministic IDs for SVG elements to facilitate diff Aug 12, 2024
@gvwilson gvwilson removed their assignment Aug 18, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature something new P3 backlog
Projects
None yet
Development

No branches or pull requests

5 participants