Weird issue: I am plotting some data, but the graph is not showing the lines.
Here is the code:
plot1 <- dat1 %>%
rename(country1 = "Region, subregion, country or area *", `1955` = "1950-1955", `1960` = "1955-1960", `1965` = "1960-1965", `1970` = "1965-1970", `1975` = "1970-1975", `1980` = "1975-1980", `1985` = "1980-1985", `1990` = "1985-1990", `1995` = "1990-1995", `2000` = "1995-2000", `2005` = "2000-2005", `2010` = "2005-2010", `2015` = "2010-2015", `2020` = "2015-2020") %>%
mutate(difference = `2020` - `1955`) %>%
mutate(hightfr = if_else(`2020` > 5, "high fertility", "fast decline")) %>%
filter(`Parent code` %in% c(911, 913)) %>%
filter(`2020` > 5 | `difference` < -3) %>%
pivot_longer(8:21, names_to = "year_range", values_to = "tfr") %>%
ggplot() +
geom_line(mapping = aes(year_range, tfr, color = `country1`)) +
geom_point(mapping = aes(year_range, tfr, color = `country1`, shape = `hightfr`))
plot1
As you can see, the years are in ranges, which someone told me may be the source of the issue.
The issue is that the points show up, but not the lines. However, the lines do show up on the key.
Does anyone know of a way to get the lines to show up on the plot?
Thank you!