Skip to contents
library(ggplot2)
library(plotly)
#> 
#> Attaching package: 'plotly'
#> The following object is masked from 'package:ggplot2':
#> 
#>     last_plot
#> The following object is masked from 'package:stats':
#> 
#>     filter
#> The following object is masked from 'package:graphics':
#> 
#>     layout
data(iris)

g <- ggplot(iris, aes(Sepal.Length, Sepal.Width, color=Species))+
  geom_point()+
  geom_smooth(method="lm")

ggplotly(g)
#> `geom_smooth()` using formula 'y ~ x'
ggplot(iris, aes(y=Sepal.Length, x=Species, fill=Species))+ geom_boxplot()+ scale_fill_manual(values = c(alpha("mediumseagreen", alpha = 0.4), "mediumorchid4", "firebrick1"))+ geom_dotplot(binaxis = "y", fill="black", binwidth = 0.05)+ labs(y="Sepal length")+ coord_flip()+ labs(x="Species")+ theme_bw()