Skip to content

fix: Plotly express widgets don't work in deephaven.ui#644

Merged
jnumainville merged 1 commit into
deephaven:mainfrom
jnumainville:450_px_not_working
Jul 19, 2024
Merged

fix: Plotly express widgets don't work in deephaven.ui#644
jnumainville merged 1 commit into
deephaven:mainfrom
jnumainville:450_px_not_working

Conversation

@jnumainville
Copy link
Copy Markdown
Collaborator

fixes #450

Plotly express' Figure object is unhashable, so it couldn't be a dictionary key.

Tested with the following snippet:

df = px.data.tips()
fig_violin = px.violin(df, y="tip", x="smoker", color="sex", box=True, points="all", hover_data=df.columns)
ui_fig_violin = ui.panel(fig_violin)
Screenshot 2024-07-18 at 6 05 31 PM

@jnumainville jnumainville requested a review from mofojed July 18, 2024 23:06
@jnumainville jnumainville self-assigned this Jul 18, 2024
object_id = self._object_id_dict.get(obj)
if object_id is None:
# it's possible that an object is not hashable, so use the id
py_id = id(obj)
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I was worried when I was reading this: https://docs.python.org/3/library/functions.html#id

Two objects with non-overlapping lifetimes may have the same id() value.
But I guess this can not be a problem since an object will be held in the _old_objects set for it's lifetime.

@jnumainville jnumainville merged commit 14555ab into deephaven:main Jul 19, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

plotly.express widgets do not work in deephaven.ui

2 participants