Hi Mariano,
Here is one way to do this.
The reference to understand this is seeing the necessary arguments to the restyle method from
using PlotlyJS, Distributions
x0 = rand(Normal(2, 0.4), 400);
y0 = rand(Normal(2, 0.4), 400);
x1 = rand(Normal(3, 0.6), 600);
y1 = rand(Normal(6, 0.4), 400);
x2 = rand(Normal(4, 0.2), 200);
y2 = rand(Normal(4, 0.4), 200);
trace0 = scatter(x=x0, y=y0, mode="markers", marker_color="DarkOrange")
trace1 = scatter(x=x1, y=y1, mode="markers", marker_color="Crimson")
trace2 = scatter(x=x2, y=y2, mode="markers", marker_color="RebeccaPurple")
layout = Layout(
updatemenus=[
attr(
buttons=[
attr(label="1 in Red",
method="restyle",
args=[attr(marker_color="red"),
[0]]
),
attr(label="2 in Blue",
method="restyle",
args=[attr(marker_color="blue"),
[1]]
),
attr(label="3 in Green",
method="restyle",
args=[attr(marker_color="green"),
[2]]
),
attr(label="All in Black",
method="restyle",
args=[attr(marker_color="black")]),
attr(label="Show None",
method="restyle",
args=[attr(marker_color=false)]),
],
)
],
title_text="Highlight Clusters",
showlegend=false
)
plot([trace0, trace1, trace2], layout)