R boxplot; center the axis labels under the tick marks -


i plotted dataframe (16700 obs. of 6 variables) using following code:

labels <–c("x2137_fe20","x2137_fexs","vtc1_fe20", "vtc1_fexs","vtc1c_fe20","vtc1c_fexs") #labels x axis [1]col <- c("chartreuse3", "chocolate2", "chartreuse3", "chocolate2",  "chartreuse3", "chocolate2") #colors  #plot boxplot(cvtable,      outline = false,      ylim = c(-0.5,70),      main="cv replicas",     ylab="rsd(%)",     range = 1.5,     width = c(9,9,9,9,9,9),     plot = true,     col = col,     par (mar = c(5,4.5,5,0.5) + 0.1),      par(cex.lab=2),      par(cex.axis=1.7),      notch = true,     labels = labels) dev.off() 

this result

i box plot, there couple of things adjust. need keep font size x axis labels, can see labels big , part of them missed. solution rotate them 45 degrees, not manage find easy code insert in script.

i tried delete original axes (axes=false), setting new ones

boxplot(cvtable,      outline = false,      ylim = c(0.5,70),      ylab="rsd(%)",     range = 1.5,     width = c(9,9,9,9,9,9),     plot = true,     col = col,     par (mar = c(5,4.5,5,0.5) + 0.1),      notch = true,     par(cex.lab=1.7),     axes=false)  axis(1, @ = c(1,2,3,4,5,6), labels = f, tick = 2, line = na,  pos = -1, outer = f, font = 3, lty = "solid",  lwd = 2, lwd.ticks = 3, col = null, col.ticks = null,  hadj = na, padj = 0)  axis(2, @ = c(0,10,20,30,40,50,60,70) , labels =   c(0,10,20,30,40,50,60,70), tick = 2, line = na,  pos = 0.5, outer = false, font = 1, lty = "solid",  lwd = 2, lwd.ticks = 3, col = null, col.ticks = null,  hadj = na, padj = 0, par(cex.lab=1.5))  text(x=c(1,2,3,4,5,6),   y=par()$usr[3]-0.1*(par()$usr[4]-par()$usr[3]),  labels=labels, srt=45, adj=1, xpd=true, par(cex.lab=2)) 

and output: img2 well, not know how center labels under tick marks , how extend x axis origin of graph (left) , end of last box (right). moreover, argument par(cex.lab=2) fix x axis labels font size seems no longer working in string.

any suggestion?

ps: 1st post, if needed info missed, please leave comment , reply can. thank you!

i made myself:

 #rsd boxplot(cvtable[1:6],      outline = false,     ylim = c(0.5,70),      ylab="rsd(%)",     range = 1.5,     width = c(9,9,9,9,9,9),     plot = true,     col = col,     par (mar = c(7,4.5,1,0.5) + 0.1),       notch = true,     par(cex.lab=1.7),     axes=false)  axis(1, @ = c(0.5,1,2,3,4,5,6,7), labels = f, tick = 2, line = na,  pos = -1, outer = f, font = 3, lty = "solid",  lwd = 2, lwd.ticks = 3, col = null, col.ticks = null,  hadj = na, padj = 0)  axis(2, @ = c(0,10,20,30,40,50,60,70) , labels =  c(0,10,20,30,40,50,60,70), tick = 2, line = na,  pos = 0.5, outer = false, font = 4, lty = "solid",  lwd = 2, lwd.ticks = 3, col = null, col.ticks = null,  hadj = na, padj = 0, par(cex=1.4))  text(x=c(0.7,1.7,2.7,3.7,4.7,5.7),   y=par()$usr[3]-0.14*(par()$usr[4]-par()$usr[3]),  labels=labels, srt=45, adj=0.6, xpd=true, cex=1, font=2)  dev.off() 

this result: clickme


Comments

Popular posts from this blog

ios - MKAnnotationView layer is not of expected type: MKLayer -

ZeroMQ on Windows, with Qt Creator -

unity3d - Unity SceneManager.LoadScene quits application -