When I pass my ggplot2-object to ggplotly() it throws a strange error;
Error in train(..., self = self) : unused argument (list("b", "a", "c"))
It seems to work if I omit the color/fill arguments from the layer - but that’s nit what I want. Does anybody else get this error, or is it just me? In the example below the error occurs when I pass ggp3 to ggplotly().
df <- data.frame(a = c(1:10), b = c(2010:2019), c = c(rep("a", 5), rep("b", 5)))
# as expected
ggp1 <- ggplot(data = df) +
geom_point(aes(y = a,
x = b,
# color = c # without color
))
ggp1
ggp1 %>% plotly::ggplotly()
# as expected
ggp2 <- ggplot(data = df) +
geom_point(aes(y = a,
x = b),
color = "red") # with non aes color
ggp2
ggp2 %>% plotly::ggplotly()
# not as expected
ggp3 <- ggplot(data = df) +
geom_point(aes(y = a,
x = b,
color = c)) # with color
ggp3
ggp3 %>% plotly::ggplotly()
Any help much appreciated!