I have a simple geom_point
plot, in which the x
variable is ordinal, taking 5 values (coded 1:5).
In the plot I would like to replace it with 5 corresponding text labels. Is it possible to do it in ggplot?
I have a simple geom_point
plot, in which the x
variable is ordinal, taking 5 values (coded 1:5).
In the plot I would like to replace it with 5 corresponding text labels. Is it possible to do it in ggplot?
You should be able to do this with scale_x_discrete
.
library(ggplot2) df
scale_x_discrete
should do it:
x
Here is a reproducible example I think encapsulates your Q (?):
require(ggplot2) dat
It isn't immediately clear what data you have, but if you mean something like this:
(p1
Then I think you want a stripchart, which can be achieved in ggplot via a factor
dat2
If this isn't what you mean, can you edit your Q to provide an example?