add option to add "select" mode on any figure (specifically, Heatmap)
Nobody has claimed this yet.
- Dominant language
- Python
- Stars
- 18.8k
- Forks
- 2.8k
- Avg merge
- 16h 26m
- Merged PRs (30d)
- 21
Description
It doesn't seem possible to add a "select" dragmode to a figure with a go.Heatmap object. You can specify the starting dragmode as "select", in which case you can immediately drag and select. But if I wanted to pan, I can't choose to select afterwards. I cannot add it to the modebar. I would like to be able to do this so I can select a region of interest on my heatmap, and setup a callback to set this region of interest in my code. I don't care about actually selecting the points in the heatmap, just the bounds of the selection box.
My workaround to this is to add a go.Scatter to my figure:
layout = go.Layout(
showlegend=False,
autosize=False,
xaxis=dict(
showgrid=False,
zeroline=False,
visible=False,
range=[0, images.shape[2] - 1],
),
yaxis=dict(
showgrid=False,
zeroline=False,
visible=False,
range=[images.shape[1] - 1, 0],
scaleanchor="x",
scaleratio=1,
),
dragmode="zoom",
modebar=go.layout.Modebar(remove=["lasso"]),
)
heat = go.FigureWidget(
data=[
go.Scatter(
x=[0],
y=[0],
),
go.Heatmap(z=current_image, colorscale="Viridis"),
],
layout=layout,
)
This works, but is kind of silly...
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with the go.FigureWidget example, focusing on layout.dragmode, modebar options, and the go.Heatmap interaction described in the issue. Check how selection callbacks and selection bounds are exposed when the figure contains only a Heatmap. Done means switching between pan or zoom and select works through the modebar without adding a dummy go.Scatter.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- data-visualization
- Issue type
- Feature
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 38/100