Join GitHub today
GitHub is home to over 50 million developers working together to host and review code, manage projects, and build software together.
Sign upggerrorplot: add option to treat x as numeric axis #280
Comments
suppressPackageStartupMessages(library(ggpubr))
# Demo data
mi_df <- data.frame(
"month" = as.numeric(rep(c(0,1,2,12,15,48),30)) ,
"sust" = as.factor(rep(c(rep(c("A","B"), each=6)), 15)),
"vble" = as.numeric(rnorm(180)))
# Error plot: x-axis treated as factor (default)
ggerrorplot(
mi_df, x = "month", y = "vble",
desc_stat = "mean_sd", color = "sust", palette = c("black","grey"),
title= "smt", ylab= "vble",
position = position_dodge(0.3)
)# Using numeric x axis: numeric.x.axis = TRUE
ggerrorplot(
mi_df, x = "month", y = "vble",
desc_stat = "mean_sd", color = "sust", palette = c("black","grey"),
title= "smt", ylab= "vble",
position = position_dodge(0.3),
numeric.x.axis = TRUE
)Created on 2020-05-24 by the reprex package (v0.3.0.9001) |


The current default of
ggerrorplot()is to always treat x as a factor.The option
numeric.x.axisshould be added; logical value. If TRUE, x axis will be treated as numeric. Default is FALSE.