r - ggplot2: group x axis discrete values into subgroups -
I want to plot once with ggplot2 in which discrete values of x axis will be grouped into subgroups (see picture attached - The picture is from the web, I do not have any code for the plot yet).
Thanks for your help !
Two approaches:
Example data:
< Code> dat & lt; - data.frame (value = runif (26) * 10, group = c (representative ("group 1", 10), representative ("group 2", 10), representative ("group 3", 6)), letter = Painter [1:26] Head (Data) Price Grouping Letter 1 8.316451 Group 1A2 9.768578 Group 1B3 4.896294 Group 1C4 2.004545 Group 1 D5 4. 9 5058 Group 1 E6 8.97 7 713 Group 1F Without a mask:GGPlot (data, AES group, value, fill = letter, label = letter)) + geom_bar (position = "dodge" , State = "detection") + geom_text (position = position_tread (width = 1), AES (x = group, wa = 0)) with fittings:
ggplot (dat, aes (letter, value, label = letter))) + Geom_bar (stat = "identity") + facet_wrap (~ group, scales = "free")
The labeling clearly does not have a situation about it about fattening.
Comments
Post a Comment