Skip to content

ImageWidget.set_data() does not work if the histogram widget was never used #850

@kushalkolar

Description

@kushalkolar
IndexError                                Traceback (most recent call last)
Cell In[11], line 2
      1 sub_df = df[(df["fly"] == 4) & (df["cw"] == "rot-ccw-0.06")]
----> 2 iw.set_data([row["sample"].get_video() for i, row in sub_df.iterrows()])

File [~/repos/fastplotlib/fastplotlib/widgets/image_widget/_widget.py:946](http://localhost:8888/lab/tree/repos/fastplotlib/examples/repos/fastplotlib/fastplotlib/widgets/image_widget/_widget.py#line=945), in ImageWidget.set_data(self, new_data, reset_vmin_vmax, reset_indices)
    943 new_graphic = ImageGraphic(data=frame, name="image_widget_managed")
    945 # set hlut tool to use new graphic
--> 946 subplot.docks["right"]["histogram_lut"].image_graphic = new_graphic
    947 # delete old graphic after setting hlut tool to new graphic
    948 # this ensures gc
    949 subplot.delete_graphic(graphic=subplot["image_widget_managed"])

File [~/repos/fastplotlib/fastplotlib/layouts/_plot_area.py:689](http://localhost:8888/lab/tree/repos/fastplotlib/examples/repos/fastplotlib/fastplotlib/layouts/_plot_area.py#line=688), in PlotArea.__getitem__(self, name)
    686     if graphic.name == name:
    687         return graphic
--> 689 raise IndexError(f"No graphic or selector of given name in plot area.\n")

IndexError: No graphic or selector of given name in plot area.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions