Black Lives Matter. Please consider donating to Black Girls Code today.

Associating plot points with additional data

Is there any way to attach references to external objects when feeding Plotly the X/Y values for a chart? Basically, if I have a big set of model objects and I’m only plotting 2 of their properties, how do I know which model a given point is associated with? (For example, when clicking, selecting points, and so on).

Is the only option to rely on an array index value? My worry there is if the data is filtered, Plotly’s array index may not match the position of the model object in the pristine (unfiltered) array of model objects.

Even if there was just a way to attach some ID to each point, that would allow me to look up the original object. But I’m not seeing anything in the API that would allow me to do this.

See https://github.com/plotly/plotly.js/pull/1379

It looks like this is specific to the scatter plot. Does this also apply to scattergl? I’m not clear on whether scattergl “inherits” this from scatter.