The following records are a small sample of the dataset I'd like to plot using the scatter plot of the plotly library.
id value condition
1 0.00167736464652281 CM
1 0.00409236292494868 ECM
1 0.00402114732563961 SAX
2 0.0136247916329259 SAX
2 0.0151036287262202 ECM
2 0.0115020440436599 CM
3 0.0115571286240125 CM
3 0.0155058764871028 ECM
3 0.0162593141280405 SAX
4 0.0162953858863326 SAX
4 0.0172050279098291 ECM
4 0.0140566233578565 CM
5 0.0141510897863713 CM
5 0.0177908403313223 ECM
5 0.0181831372346949 SAX
According to the standard way (using this example) I should split the values into 3 variables - one per condition (e.g. var CM, var ECM, var SAX) as follows:
var CM = {
x: [1, 2, 3, 4, 5],
y: [0.00167736464652281, 0.0115020440436599, 0.0115571286240125, 0.0140566233578565, 0.0141510897863713],
mode: 'markers',
type: 'scatter'
};
Is there any smarter way to create the scatter plot using the structure of the sample data as it is?