mjskay / tidybayes

Bayesian analysis + tidy data + geoms (R package)
http://mjskay.github.io/tidybayes
GNU General Public License v3.0
725 stars 59 forks source link

Dotsinterval with two colors #275

Closed albertocarm closed 3 years ago

albertocarm commented 3 years ago

Hello, I would like to draw a dots interval plot to show the probability of effect greater than 0 or greater than 15% of a distribution with different colors. However, it is only shown in the vignettes for a dots point with a code similar to this one:

ggplot(we, aes(y=.variable,x = .value,fill = stat(x < 1)))+stat_dotsinterval(quantiles = 100) +theme_tidybayes()+ geom_vline(xintercept = 1, linetype = "dashed") + scale_fill_manual(values = c( "skyblue", "gray80"))+ theme(legend.position = "none")

How can add orange dots below 0.85?

albertocarm commented 3 years ago

Solution:

ggplot(we, aes(y=.variable,x = .value, fill = stat(cut(x, breaks=c(0,0.85,1,10))) ))+stat_dotsinterval(quantiles = 100) +theme_tidybayes()+ geom_vline(xintercept = 1, linetype = "dashed") + scale_fill_manual(values = c( "orange","gray80","skyblue"))+ theme(legend.position = "none")