Hover incorrect when supplying color as argument in add_trace
Noskario opened this issue · 0 comments
Noskario commented
I tried to create complex plot using add_trace. However there is problem with the hover when supplying color as argument: In this case the first and last element of the trace has no hover, sometimes it is only the first or only the last:
p1 <- plot_ly() |>
add_trace(
type = "scatter",
mode = "markers",
x = 1:3,
y = 1,
color = 1:3,
marker = list(colorscale = list(list(0, "red"), list(1, "orange")))
)
p1It works fine with
p2 <- plot_ly() |>
add_trace(
type = "scatter",
mode = "markers",
x = 1:3,
y = 1,
marker = list(color = 1:3, colorscale = list(list(0, "red"), list(1, "orange")))
)
p2When doing the equivalent thing in python with
from plotly import graph_objects as go
fig2 = go.Figure()
fig2.add_trace(
go.Scatter(x=[1,2,3], y=[1,1,1], type="scatter", mode="markers", marker={"color":[1,2,3], "colorscale":[[0,"red"],[1,"orange"]]})
)
fig1 = go.Figure()
fig1.add_trace(
go.Scatter(x=[1,2,3], y=[1,1,1], type="scatter", mode="markers", color=[1,2,3], marker={"colorscale":[[0,"red"],[1,"orange"]]})
)you get an error instead of an incorrect graph, which is better, I would claim.