This is quite similar to this question but hopefully different enough to merit a new question.
I have up to 5 observations of my value ('hours') across yearly time series data in R. Each observation thus contains a year group (grp_id) and its own unique ID (short_text).
I would like to display the values (hours) of all observations, per year, within a single bar plot in ggplot2 (set to dodge based on the unique ID, short_text) but would also like the unique ID (short_text) of each observations running along the x axis, in addition to the yearly group name (grp_id).
A little like this
Example data:
structure(list(short_text = 1:20, grp_id = c(3, 3, 4, 4, 4, 4,
4, 5, 5, 5, 5, 5, 6, 6, 6, 6, 6, 7, 7, 7), variable = c("hours",
"hours", "hours", "hours", "hours", "hours", "hours", "hours",
"hours", "hours", "hours", "hours", "hours", "hours", "hours",
"hours", "hours", "hours", "hours", "hours"), value = c("1371.28228277413",
"4117.61650085692", "4462.05401592845", "4563.63839159463", "6617.47698685436",
"10498.3641321107", "20735.9579131878", "14838.8668295674", "14884.5002478823",
"15846.5620639966", "20996.7282642214", "73321.8056031507", "29960.4636692291",
"32475.8922108366", "35534.418796457", "49040.3036856129", "121255.358807715",
"15288.7191802188", "69888.6583792545", "127734.59190842")), .Names = c("short_text",
"grp_id", "variable", "value"), row.names = c(NA, 20L), class = "data.frame")
The nearest I so far have is this, but the unique IDs do not show up along the x axis:
ggplot(allBinsTop5.m, aes(grp_id, value)) +
geom_bar(aes(fill = short_text), position = "dodge", stat="identity") +
theme(axis.title.y=element_blank(),
axis.text.y=element_blank(),
axis.ticks.y=element_blank(),
axis.text.x = element_text(angle = 45, vjust = 1, hjust=1),
legend.position="none")