Reputation: 3
I have this plot currently where the 4 x-axis ticks are evenly spaced apart:
https://i.sstatic.net/VXfQt.png
The spacing between 26, 27, and 28 degrees is fine but I want a larger gap between 22.5 and 26 degrees because it is a 3.5 degree difference instead of just one degree.
Here is my current code:
Line = ggplot(grouped_data, aes(temp, pct.male, group=sire, color=sire)) +
geom_line(size=1.3) +
geom_point(aes(shape=sire), size=2.5) +
xlab("Incubation temperature (°C)") +
ylab("Sex ratio (proportion male)") +
ggtitle("Sex ratio reaction norms as a function of incubation temperature (2017 data only)") +
scale_shape_manual(values=seq(0,15))
Line
Any help with solving this problem would be much appreciated! Thank you!
Upvotes: 0
Views: 746
Reputation: 145775
Your x-axis is being treated as categorical. Convert the temp
column to numeric so it will be treated as numeric:
grouped_data$temp = as.numeric(as.character(grouped_data$temp))
You may want to specify the same axis breaks,
...your plotting code... +
scale_x_continuous(breaks = unique(grouped_data$temp))
If this doesn't work or you need more help, please share a reproducible sample of data. dput(grouped_data)
is a great way to share data because it's copy/pasteable.
Upvotes: 1