-
-
Notifications
You must be signed in to change notification settings - Fork 2.6k
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
Erratic behavior when working with multiple FigureWidget instances (after adoption of anywidget?) #4933
Comments
Thank you for this detailed bug report! I'm looking into this now. I am seeing what you're seeing with rerunning the cells. One behavior I'm already seeing is that if you restart the kernel before re-running the cell, this bug doesn't occur (still a bug, just noting this for debugging). |
@marthacryan great! Happy to provide support where it'd be of use :) |
Hi @marthacryan, I've observed some new, potentially positive behavior. If I first create an instance of Example: import plotly.graph_objects as go
# Create a Plotly figure
fig = go.Figure()
# Add an image to the figure
fig.add_layout_image(
dict(
source="https://images.plot.ly/language-icons/api-home/python-logo.png",
xref="x",
yref="y",
x=1,
y=1,
sizex=1,
sizey=1,
xanchor="center",
yanchor="middle"
)
)
fig = go.FigureWidget(fig)
fig |
Update: I've corrected the above example; |
@robertcollar-kobold Thank you again for making this detailed bug report! I've added a PR (#4956) that fixes it for me in all of your examples. Do you mind trying it out to make sure that it's working for you too? You can use this command to install that branch: |
Sure! I'll give it a shot first thing tomorrow. |
@marthacryan Woohoo! All the previously misbehaving examples now behave as expected. Thank you for your efforts here; from the PR, it clearly took some sleuthing to nail down the issue! |
@robertcollar-kobold Thank you for trying that out! It should go into the next release. |
Hey Plotly team!
I had just created an issue about images failing with the new
FigureWidget
. However, I've come to realize that the issue is more nuanced (and general) than previously noted and so thought I'd close that issue and open a new one.An image can be added to an instance of a
FigureWidget
, but only to the first instance; an image cannot be added to a second. The same goes for heatmaps. Slightly different behavior, though still unexpected, is observed for bars. I suspect this erratic behavior is associated with the adoption ofanywidget
(PR #4823).Consider the following examples (run from a classic jupyter notebook in Chrome):
Example 1a: successful addition of image to two
FigureWidget
instances (expected behavior, pre-anywidget)plotly v5.24.1
anywidget not installed
notebook v7.3.1
run the cell below twice
first output:
second output:
Example 1b: unsuccessful addition of image to two
FigureWidget
instances (unexpected behavior, post-anywidget)plotly v6.0.0rc0
anywidget v0.9.13
notebook v7.3.1
run the cell below twice
first output:
second output:
Example 2a: successful addition of heatmap to two
FigureWidget
instances (expected behavior, pre-anywidget)plotly v5.24.1
anywidget not installed
notebook v7.3.1
run the cell below twice
first output:
second output:
Example 2b: unsuccessful addition of heatmap to two
FigureWidget
instances (unexpected behavior, post-anywidget)plotly v6.0.0rc0
anywidget v0.9.13
notebook v7.3.1
run the cell below twice
first output:
second output:
Example 3a: successful addition of bars to two
FigureWidget
instances (expected behavior, pre-anywidget)plotly v5.24.1
anywidget not installed
notebook v7.3.1
run the cell below twice
first output
second output
Example 3b: discrepancy in addition of bars to two
FigureWidget
instances (uexpected behavior, post-anywidget)plotly v6.0.0rc0 (after anywidget added as dependency)
anywidget v0.9.13
notebook v7.3.1
run the cell below twice
first output
second output
I suspect that, for an experienced Plotly developer, the change in the last example might be diagnostic (fingers crossed).
Of note, this issue doesn't arise when adding multiple datasets to the same
FigureWidget
instance; consider the following:Example 4: (expected behavior, post-anywidget)
plotly v6.0.0rc0
anywidget v0.9.13
notebook v7.3.1
cell 1
cell 2
cell 3
Any ideas on why having multiple
FigureWidget
instances would cause such erratic behavior following the adoption ofanywidget
?This is the official end of the issue, but I had gone through some additional examples and have included them below in case they're of use:
Example 5a: successful addition of image to both
FigureWidget
instances (expected behavior, pre-anywidget)plotly v5.24.1
anywidget not installed
notebook v7.3.1
cell 1
cell 2
Example 5b: unsuccessful addition of image to first
FigureWidget
instance but not second (unexpected behavior, post-anywidget)plotly v6.0.0rc0
anywidget v0.9.13
notebook v7.3.1
cell 1
cell 2
Example 6a: successful addition of image to second
FigureWidget
instance regardless of data added to firstFigureWidget
instance (expected behavior, pre-anywidget)plotly v5.24.1
anywidget not installed
notebook v7.3.1
cell 1
cell 2
Example 6b: unsuccessful addition of image to second
FigureWidget
instance regardless of data added to firstFigureWidget
instance (unexpected behavior, post-anywidget)plotly v6.0.0rc0
anywidget v0.9.13
notebook v7.3.1
cell 1
cell 2
The text was updated successfully, but these errors were encountered: