Skip to content

Instantly share code, notes, and snippets.

@paleolimbot
Created June 3, 2019 13:08
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save paleolimbot/82056e959495a6c4efe15ce7e1baf166 to your computer and use it in GitHub Desktop.
Save paleolimbot/82056e959495a6c4efe15ce7e1baf166 to your computer and use it in GitHub Desktop.
Suggestion for changes in HistDAWass for the release of ggplot2
library(ggplot2)
# these are defined elsewhere
x <- runif(100)
border <- "black"
xlabel <- "xlabel"
col <- "white"
compQ <- function(x, quant) quantile(x, quant)
# this is where your code
qua=c(0,0.25,0.5,0.75,1)
df = data.frame(ymin = 0, lower = 0, middle = 0, upper = 0, ymax = 0)
for (i in 1:5){
df[[i]]=compQ(x,qua[i])
}
df$x = factor(0)
ggplot(df, aes_all(names(df)))+
geom_boxplot(stat = "identity", fill=col, size=1, colour=border)+
ylab(xlabel) +xlab("")+
ggtitle("Horizontal Boxplot")+coord_flip()
@paleolimbot
Copy link
Author

library(ggplot2)

# these are defined elsewhere
x <- runif(100)
border <- "black"
xlabel <- "xlabel"
col <- "white"
compQ <- function(x, quant) quantile(x, quant)

# this is where your code
qua=c(0,0.25,0.5,0.75,1)
df = data.frame(ymin = 0, lower = 0, middle = 0, upper = 0, ymax = 0)
for (i in 1:5){
  df[[i]]=compQ(x,qua[i])
}
df$x = factor(0)

ggplot(df, aes_all(names(df)))+
         geom_boxplot(stat = "identity", fill=col, size=1, colour=border)+
         ylab(xlabel) +xlab("")+
         ggtitle("Horizontal Boxplot")+coord_flip()

Created on 2019-06-03 by the reprex package (v0.2.1)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment