Reputation: 1
Very simple question here, but the answer continues to elude me. When I plot my data without specifying any x-axis labels, it plots with useless intervals (0.5, 1.5, 2.5) when my points of interest are 0, 1, and 2. When I use scale_x_discrete to relabel the tick marks, it always leaves the first mark blank and widens the range of the scale. Below is the code I'm using to attempt to relabel the tick marks. I can upload images of it with and without the scale_x code if that's helpful. Essentially, All I'm trying to do is relabel the tick marks like I relabeled the x-axis title.
plot2 <-
ggplot(m1, aes(OPw, RTs)) +
stat_summary(fun.y=mean, geom="point", fill="red", pch=21, size=3) +
geom_smooth(method = "lm") +
scale_x_discrete(name="Ordinal Position Within-Novelty",
breaks=c("0", "1", "2"),
labels=c("1", "2", "3"))
Upvotes: 0
Views: 85
Reputation: 1
This was solved by removing the parentheses around the break values and specifying the limits at the same values as breaks and labels—FYI in case anyone else encounters the same error.
p2 <- ggplot(m1, aes(OPb, RTs)) +
stat_summary(fun.y=mean, geom="point", fill="red", pch=21, size=3) +
geom_smooth(method = "lm") +
scale_x_discrete(name="Ordinal Position Between-Novelty",
breaks=c(0, 1, 2, 3),
labels=c(0, 1, 2, 3),
limits=c(0, 1, 2, 3)) +
Upvotes: 0