-4

I have conducted an LSD using agricolae the out put has letters assigned to groups that denote which groups are significantly different from one another. I would like to be able to generate a bar plot that shows the letters above each bar so it is easy to see what treatments are significantly different from one another.

I have tried using the "bar.group" function to generate a graph which works well, however as I have 13 seperate treatments the x-axis labels are overlapping.

I would either like to change the orientation of the x-axis labels to 90 degrees or if this is not possible find another way to plot a bar graph showing the significance as letters above each of the bars.

The current code I am using to generate a plot is

bar.group(breakdown.LSD$groups, ylim=c(0,100))

The following is a sample of the data that I am working with

structure(list(treatment = structure(c(1L, 1L, 1L, 1L), .Label = c("0.5 Fungaflor", 
"0.5 Tecto", "0.5 Tecto Fungaflor", "1 Fungaflor", "1 Tecto", 
"1 Tecto Fungaflor", "2 Fungaflor", "2 Tecto", "2 Tecto Fungaflor", 
"4 Fungaflor", "4 Tecto", "4 Tecto Fungaflor", "Water"), class = "factor"), 
    breakdown = c(11.11111111, 16.66666667, 20, 16.66666667), 
    stems = c(2.888888889, 2.916666667, 3.2, 3.166666667), tubers = c(6.666666667, 
    9.166666667, 8.466666667, 9.5), stemtubers = c(2.307692308, 
    3.142857143, 2.645833333, 3)), .Names = c("treatment", "breakdown", 
"stems", "tubers", "stemtubers"), row.names = c(NA, 4L), class = "data.frame")
  • 1
    I think it is better if you provide an example with some data. – kangaroo_cliff Feb 09 '18 at 03:39
  • I have added the data set, but as I am a new user I do not have the ability to put up a picture of the figure that i am generating to further highlight the situation – William Percey Feb 12 '18 at 02:18
  • See [here](https://stackoverflow.com/questions/5963269/how-to-make-a-great-r-reproducible-example) on how to copy your data using `dput`. You can find general instructions to create a minimal example [here](https://stackoverflow.com/help/mcve) – kangaroo_cliff Feb 12 '18 at 02:22
  • I think i have provided the sample data in the format that you were asking for now – William Percey Feb 12 '18 at 03:49
  • William, I was not "asking", I was trying to help you ask a better question. – kangaroo_cliff Feb 12 '18 at 04:18

1 Answers1

0

If I understand your question correctly this should be a really easy fix. I am unfamiliar with the bar.group() function, however, using las = 2 inside is the general way of rotating axis labels. If this doesnt work and you can not use the rbase barplot() function I would just remove the x xasis (generally done by including xaxt="") and then add a new axiswith a seperate command following the barplot() or bar.group() command.

 axis(1,at=breakdown.LSD$groups, 
labels = c("Whatever","Your","labels","Are"), las=2)

As for the significance labels. They can be added to the plot with the text() command (Which should follow your graph command). just give the x and y coordinates and include your labels.

text(x=breakdown.LSD$groups, y = , 
labels = c("Whatever","Your","labels","Are"))

hope this helped.

THATguy
  • 292
  • 2
  • 11