# Limiting drawrect annotations to one

**URL:** <https://community.plotly.com/t/limiting-drawrect-annotations-to-one/87496>\
**Category:** Dash Python\
**Tags:** question\
**Created:** [September 23, 2024, 7:13pm UTC](https://community.plotly.com/t/limiting-drawrect-annotations-to-one/87496 "2024-09-23T19:13:56Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![fiammante](https://avatars.discourse-cdn.com/v4/letter/f/f05b48/32.png) [@fiammante](https://community.plotly.com/u/fiammante)\
**Post date:** [September 23, 2024, 7:13pm UTC](https://community.plotly.com/t/limiting-drawrect-annotations-to-one/87496/1 "2024-09-23T19:13:56Z")

</div>

In a Dash callback to get relayoutData drawrect annotations I want to limit the rectangle to one, the most recent one.  
Updating shape array from relayoutData has no effect and I have no access to Graph figure from callback. Passing figure in State did not hello.  
What is the solution?  
Thank you in advance

---

<div class="post-metadata">

**Author:** ![fiammante](https://avatars.discourse-cdn.com/v4/letter/f/f05b48/32.png) [@fiammante](https://community.plotly.com/u/fiammante)\
**Post date:** [September 24, 2024, 11:15am UTC](https://community.plotly.com/t/limiting-drawrect-annotations-to-one/87496/2 "2024-09-24T11:15:48Z")

</div>

Solved: added figure as State and Output

shape = shapes[-1] # Get the latest shape  
relayoutData[‘shapes’]=[shape]  
fig[‘layout’][‘shapes’]=relayoutData[‘shapes’] # update figure
