# Adding 3D plot annotation upon click

**URL:** <https://community.plotly.com/t/adding-3d-plot-annotation-upon-click/26306>\
**Category:** plotly.js\
**Created:** [July 24, 2019, 9:35am UTC](https://community.plotly.com/t/adding-3d-plot-annotation-upon-click/26306 "2019-07-24T09:35:36Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![NabJa](https://avatars.discourse-cdn.com/v4/letter/n/f07891/32.png) [@NabJa](https://community.plotly.com/u/NabJa)\
**Post date:** [July 24, 2019, 9:35am UTC](https://community.plotly.com/t/adding-3d-plot-annotation-upon-click/26306/1 "2019-07-24T09:35:36Z")

</div>

Hi there,

I am trying to add annotations to a point in a 3D scatter plot upon a click.  
Here is my example that does crash upon a click: [3D-plot-annotation-example](https://codepen.io/NAJA040/pen/zgqRxo?editors=1010)

The example is based on [example-link](https://plot.ly/javascript/text-and-annotations/#3d-annotations) .

The errors I get:  
Error: attribute transform: Trailing garbage, “rotate(0,NaN,NaN)”.  
Error: attribute d: Expected number, “MNaN,NaNLNaN,NaN”.

Thank you …

---

<div class="post-metadata">

**Author:** ![etienne](https://sea2.discourse-cdn.com/flex024/user_avatar/community.plotly.com/etienne/32/17_2.png) [@etienne](https://community.plotly.com/u/etienne)\
**Post date:** [July 24, 2019, 5:49pm UTC](https://community.plotly.com/t/adding-3d-plot-annotation-upon-click/26306/2 "2019-07-24T17:49:14Z")

</div>

Here’s a working example: [https://codepen.io/etpinard/pen/bXebYX?editors=1010](https://codepen.io/etpinard/pen/bXebYX?editors=1010)

Some notes:

- you need to relayout into `scene.annotations` - not `annotations` which are reserved for (x,y) annotations
- you need to register the event handler using `.once` (instead of `.on`) to workaround the 3d render loop (more on that topic in [https://github.com/plotly/plotly.js/issues/1025](https://github.com/plotly/plotly.js/issues/1025))
