Reputation: 1706
I want something similar to my example but replacing the line by a point in black color. Is it possible? The documentation does not mention this.
Data & example :
library(plotly)
set.seed(1234)
plot_ly(x = ~mean(rnorm(50)), y=c(-2,2), type='scatter', mode='lines') %>%
add_boxplot(x = ~rnorm(50), inherit = F) %>%
layout(yaxis = list(range = c(-2, 2)))
I want something similar to this in ggplot2 :
stat_summary(fun.y=mean, geom="point", shape=23, size=4)
Upvotes: 1
Views: 51
Reputation: 1279
How about the following?
library(plotly)
set.seed(1234)
plot_ly(x = ~mean(rnorm(50)), y=c(-2,2), line = list(color = 'black'), type='scatter', mode='lines') %>%
add_boxplot(x = ~rnorm(50), inherit = F) %>%
layout(yaxis = list(range = c(-2, 2)))
However I'm not sure what you mean by replacing the line by a point in black color. Do you mean you want two points, with the same x values, but at -2 and +2 on the y scale? If so, why?
Upvotes: 1