Thursday 15 April 2010

r - dotted lines in addition to outlier in geom_box -



r - dotted lines in addition to outlier in geom_box -

how add together dotted lines , horizontal bars @ end of dotted lines boxplot in ggplot? default creates vertical lines going out box. please see illustration below how want it:

here code

p <- ggplot(data, aes(factor(length,levels=18:26), logfc)) + geom_boxplot(fill = "white") + coord_cartesian(ylim=c(-5,5)) + theme_bw(base_size=45) + scale_x_discrete("", breaks=factor(18:26), drop=false)

@cmichael cites answer. simply illustrates it. first, toy data.

year <- rep("2014", 10) total <- c(seq(55, 90, 5), 100, 40) df <- data.frame(year = as.factor(year), total = total)

then plot, showing dotted lines , color.

ggplot(df, aes(x=factor(year), y=total)) + geom_boxplot(linetype = "dotted", color = "red") + theme_bw()

r ggplot2

No comments:

Post a Comment