am1234
April 15, 2023, 1:02pm
1
Hi there,
I’ve been adding annotations to a figure using fig.add_annotations(...)
. However I want to be able to access the current annotations of a figure object and delete the ones I don’t want.
Many thanks.
AIMPED
April 15, 2023, 1:20pm
2
Here is an example on how to create annotations. Deleting them would be just deleting the corresponding list entry.
Hi everyone. Regarding image annotations using Plotly Dash, I’ve done the tutorials found here: https://dash.plotly.com/annotations .
My question is this, suppose I draw a square shape - how do I automatically draw a circle shape using the mouse information provided by the square shape?
Can someone please point to a location where I can learn to do this?
I’ve been able to do all the examples found in “Image Annotations” section, but I haven’t been able to figure out the code, and callback to a…
from dash import Dash, dcc, html, Input, Output, State
import dash_bootstrap_components as dbc
from dash.exceptions import PreventUpdate
import plotly.express as px
import numpy as np
# create image and plotly express object
img = np.random.randint(0, 255, (90, 160))
fig = px.imshow(img, color_continuous_scale='Blugrn')
# update layout
fig.update_layout(
template='plotly_dark',
plot_bgcolor='rgba(0, 0, 0, 0)',
paper_bgcolor='rgba(0, 0, 0, 0)',
width=700,
height=500,
margin={
'l': 0,
'r': 0,
This file has been truncated. show original