'How to show values in ggplot instead of geom
I have a dataset that looks as follows:
cluster <- c(rep(c(1:4), 2))
score <- c(1.3, 7.2, 4.9, 7.5, 6.8, 4.1, 9.9, 5.8)
x_axis <- c(rep("indicator1", 4), rep("indicator2", 4))
dt <- data.table(cluster, score, x_axis)
and I am plotting the score for each indicator by cluster:
ggplot() +
geom_point(data=dt, aes(x=x_axis, y=score))
I would like to do one of the following:
- Replace the dots in the plot with cluster number (or put the number next to the dot), or
- Use different shapes/color for each cluster and add a legend below the plot, indicating to which cluster does each shape correspond to.
How can I do this?
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
