r - Need support with formatting x-axis group labels to not overlap -


I created an open box plot of some data in R using the ggplot2 package. I have a problem that the X-axis element text labels the overlap of my groups, which I do not want.

I do not want to rotate the label, preferably, I would like to write each label horizontally, but continued on the 'separate' row. So that (eg) two words of label Carboniferous Lst The second word appears with two words 'limestone', which is written horizontally below the carboniferous. I can not reduce the font size, because it will be very difficult to read.

Does anyone know that there is a command in RGG Plot which takes care of it?

Many thanks

DMIANO

PS: My current code is:

  box & lt; - ggplot (aquipops, aes (geology, logron)) box + geom_boxplot (footnote = tru) + labs (x = "", y = "mean log transceiversiveness (m2 / d)") + theme (axital = element_text = "Bold", size = "12", color = "black"), axis.txt = element_text (size = 10, face = "bold", color = "black"), axis.title.y = element_text (vjust = 1), axis.title.x = element_text (wrong = 0.005))  

I think I need to change something in the axis.title.x = element_text command?!? !

this way?

  set example #seed ( 1) Name & lt; - paste ("carbonifier species", 1: 8) d (Android) = () = () = () = () = () = () = TRUE) + scale_x_discrete (label = gsub ("carbonformer") , "\\ 1 \ n", unique (name $ DF)) + theme (axis.title = element_text (face = "bold", size = "12xx.title.y = element_text (vjust = 1), axis. Title.x, "axis.title.x", "axis.title.x", "color" = "black"), axis = text = element_text (size = 10, face = "bold", color = "black" ), Axis.title.y = element_text (vjust = 1), axis.title.x = Element_text (vjust = 0.005))  

The above code from the insertion code scale_x_discrete (labels = ...) using the .

line breaks in the axis labels.

You can directly access your data You can insert these breaks, such as:

  df $ name & lt; - gsub ("(carbonifiers)", "\\ 1 \ n",  

The above written code will then generate the same plot above.


Comments

Popular posts from this blog

apache - 504 Gateway Time-out The server didn't respond in time. How to fix it? -

c# - .net WebSocket: CloseOutputAsync vs CloseAsync -

c++ - How to properly scale qgroupbox title with stylesheet for high resolution display? -