-1

i have been struggeling on a barplot two days now but i really need some help here. What i need is 4 barplots diagrams besides each other for the four levels of burning degrees in a forest (level 1-4), in each graph i want a distribution of diametres of trees (no.= 9005 trees) with classes from 1(<10cm) to 10(>=50 cm).xlab=classes of diametre (1-10); ylab= number of stems in this diametre class. But i have different numbers of trees for each level so i would need to use the mean for every bar (devide the sum with the number of stems with the same number A03,...) or group them through the column "class" which already is the diameter class. And last but not least i want to bars next to each other(or one after teh others) for the two periods (2011 and 2020).

no. dbh year level class A03 19 2011 unverbrannt 1 A03 19 2011 kaum verbrannt 2 A04 27 2011 kaum verbrannt 3 A04 15 2011 kaum verbrannt 4 A05 33 2011 kaum verbrannt 5 B01 21 2011 kaum verbrannt 6 . 2020 . 7 2020 kaum verbrannt 8 . 2020 . 9 . . schwach verbrannt 10 . . . . stark verbrannt

In the end it should look like this: https://luisdva.github.io/rstats/Diverging-bar-plots/

I hope it makes any sense.

Thanks in advance Elsa

stefan
  • 90,330
  • 6
  • 25
  • 51
Else
  • 1
  • 1
  • 1
    Welcome to SO! It would be easier to help you if you provide [a minimal reproducible example](https://stackoverflow.com/questions/5963269/how-to-make-a-great-r-reproducible-example) including the code you have tried and a snippet of your data or some fake data. – stefan May 08 '22 at 14:29
  • Please provide enough code so others can better understand or reproduce the problem. – Community May 09 '22 at 01:44

1 Answers1

0

Yes of course. This is my data. I have: 10 groups diametre distribution classes "BHD klasse" and 2 time periods (jahr) and i wanne get a graph for each 4 groups degree of burning "grad" ( with ggplot facet wrap maybe):

i just could reproduce or copy the code in here so here is an example:

BHD Klasse Jahr grad
1 2011 stark 2 2011 schwach 3 2020 nicht 4 2020 kaum 5 2020 kaum

i tried to use the gplot

BHD Klasse     jahr      grad

1              2011      stark
2              2020      schwach
1              2011      kaum
5              2020      stark
10             2020      nicht




ggplot()+ geom_histogram(data=bhdklass,aes(x = bhdklasse, fill=jahr))

would be awesome if i´d hear from you

Else
  • 1
  • 1
  • Please edit the question to include this information instead of providing it as an answer. – lhs May 26 '22 at 18:14