Skip to content

R plotly to be similar to R dygraph #4

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
tanthiamhuat opened this issue Jun 11, 2021 · 0 comments
Open

R plotly to be similar to R dygraph #4

tanthiamhuat opened this issue Jun 11, 2021 · 0 comments

Comments

@tanthiamhuat
Copy link

Hello 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:
image

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

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')
p2
``

Thanks.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant