R plotly to be similar to R dygraph

Hello R Plotly Expert,

is the plotly in R able to have the similar feature as in dygraph?
What I am looking for is in plotly is that in dygraph, when we move about the plot, its values are able to show on the top legend, as seen here:

When I do the similar one using Plotly, I can only see below:

I would like the values to be displayed on the legend at the top, as what dygraph is able to do it.
Is this possible?

If it is possible, some code example to modify my below would be fantastic:

DateTime <- ExtruderTemperature$DateTime
head_temp <- ExtruderTemperature$head_temp
melt_temp <- ExtruderTemperature$melt_temp
screw_temp <- ExtruderTemperature$screw_temp

p1 <- ggplot(ExtruderTemperature,aes(x=DateTime)) +
geom_line(aes(y=head_temp, color = 'head_temp')) +
geom_line(aes(y=melt_temp, color = 'melt_temp')) +
geom_line(aes(y=screw_temp, color = 'screw_temp'))

p2 <- ggplotly(p1, tooltip = c("DateTime","y")) %>%
config(displayModeBar = F)
p2 <- layout(p2, legend = list(orientation = "h", # show entries horizontally
xanchor = "center", # use center of legend as anchor
x = 0.5), # put legend in center of x-axis
hovermode = 'x unified')


Forgive me if this is a silly question, but Why not use dygraph ?

it is actually not a silly question, but a silly problem with dygraph itself....
see my post at

I actually do not want to rework everything from dygraph to plotly too, it is just wasting too much time.. but I just have no other choice... unless the above silly issue is solved.

This topic was automatically closed 21 days after the last reply. New replies are no longer allowed.

If you have a query related to it or one of the replies, start a new topic and refer back with a link.