I have a dataframe that looks like this:
ID Group Measure1 Measure 2
001 A 59 559
002 A 44 623
003 B 129 498
004 C 99 504
005 C 78 378
I want to produce a bar graph that has two sets of labels on the X-axis: one identifying each bar with its ID value, another labeling each bar by Group it belongs to. My data is set up so that members of the same group are adjacent in the dataframe.
The obvious solution of color-coding the bars by Group is not applicable because I am already using color-coding to show Measure1 and Measure2 (and in some cases Measure3). If there is another way to show the Group information besides labels, I am interested to hear it but I think that two sets of labels at the bottom of my chart is probably the best solution. Here's one such plot with only one set of labels:
I would like to add the Group labels underneath the "Patient ID" labels.
If I get desperate, I will use Photoshop or Paint to add the labels but I am hoping there is a way to add a second set of labels using R.