Reputation: 717
The following are my r code
for the scatterplot.
library(tidyverse)
Pop <-c(24039274, 24854892, 25718048, 26624820, 27568436, 28543940, 29550662, 30590487, 31663896, 32771895)
Popu <- data.frame(Year = 2000:2009, lpop = log2(Pop))
ggplot(Popu, aes(Year, lpop)) +
geom_point(size=3, col = "steelblue") +
ylab("Log2 of Population")
My question is, why the x axis reflects 2000.0, 2002.5 and so on? How do I fix this one?
Thank you in advance.
Upvotes: 1
Views: 345
Reputation:
Try this:
Popu <- data.frame(Year = factor(seq(2000,2009,1)), lpop = log2(Pop))
ggplot(Popu, aes(Year, lpop)) +
geom_point(size=3, col = "steelblue") +
ylab("Log2 of Population")
Upvotes: 3