plot - Change boxplot x axis labels alignment in r -ggplot2 -


i'm new using rstudio please forgive me if i'm overlooking obvious method of solving problem.

i have produced boxplot in r right, except change alignment/or size of x-axis labels/text.

i using rstudio version 3.1, has changed since r version 2.13.1 (2011-07-08) platform: x86_64-pc-mingw32/x64 (64-bit) code then, not working me.

there 2 species , 5 treatments, intention draw box plot interaction between species , treatment, lined there species 1 treat 1, species 2 treat 1, species 1 treat 2, species 2 treat 2 etc.

the code has worked far is:

pseudodata <- read.csv(file.choose(), header=true) pseudodata$agg_count <- rep(1:60, each=2)  data <- aggregate(pseudodata , by=list(pseudodata$agg_count), fun=mean)  boxplot   (force..n. ~ interaction(data$species, data$treatment),            data=data, col=(c("gold","darkgreen")),           xlab="species , treatment", ylab="force of detachment (n)") 

which produced boxplot similar second boxplot colour notched

however x axis text labels not show, set them @ 45o angle.

i have tried:

labels <- c("helix.copper", "hibernica.copper","helix.easy on", "hibernica.easy on",             "helix.pegagraff", "hibernica.pegagraff", "helix.untreated",              "hibernica.untreated", "helix.zinc", "hibernica.zinc")  forceplot <- boxplot(force..n. ~ interaction(data$species, data$treatment),          data=data,  # dataframe used         xaxt="n", # suppress default x axis         col=(c("gold","darkgreen")),         xlab="species , treatment", ylab="force of detachment (n)")  text(forceplot, par(“usr”)[3], labels = labels, srt = 45,          adj = c(1.1,1.1), xpd = true, cex=.9)         ) axis(2) 

but doesn't appear work , don't know why. if has ideas how create plot grateful.

i not sure if want. approach you?

library(ggplot2)  ### create sample data species <- rep(c("s1","s2"), each = 20, times = 5) treatment <- rep(c("t1","t2","t3","t4","t5"), each = 1, times = 40) value <- runif(200, 100, 500)  foo <- data.frame(cbind(x,y,value)) foo$value <- as.numeric(foo$value)  ### draw boxplots ana <- ggplot(foo, aes(x = species, y = value, fill = treatment)) +     geom_boxplot()  ana 

Comments

Popular posts from this blog

javascript - Jquery show_hide, what to add in order to make the page scroll to the bottom of the hidden field once button is clicked -

javascript - Highcharts multi-color line -

javascript - Enter key does not work in search box -