10000 Plotly in R. How to remove annotation based on the legend. The data points are still there when the legend is hidden. · Issue #1915 · plotly/plotly.R · GitHub
[go: up one dir, main page]

Skip to content

Plotly in R. How to remove annotation based on the legend. The data points are still there when the legend is hidden. #1915

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
Renitstark opened this issue Feb 2, 2021 · 1 comment

Comments

@Renitstark
Copy link

Is there a way to remove the numbers when removing the line graph. It should display the correct data annotation when the particular legend is selected
3SJOc

library(plotly)

trace_0 <- rnorm(100, mean = 5)
trace_1 <- rnorm(100, mean = 0)
trace_2 <- rnorm(100, mean = -5)
x <- c(1:100)

data <- data.frame(x, trace_0, trace_1, trace_2)

fig <- plot_ly(data, x = ~x)
fig <- fig %>% add_trace(y = ~trace_0, name = 'trace 0',mode = 'lines') %>%
add_annotations(x = ~x, y = ~trace_0, text = ~x, showarrow = FALSE) %>%
layout(showlegend = TRUE)

fig

@KathaRRRina
Copy link

I am facing the same problem. Did you find a solution?

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

2 participants
0