This is the first time I have posted. Please excuse me if this question has been answered elsewhere, or if it is poorly explained.
> summary(pivoteddata)
country year value
Belgium :35 Length:175 Min. :54.50
France :35 Class :character 1st Qu.:80.30
Italy :35 Mode :character Median :86.10
Spain :35 Mean :82.37
United States:35 3rd Qu.:87.55
Afghanistan : 0 Max. :95.50
(Other) : 0 NA's :164
> dput(head(pivoteddata, 20))
structure(list(country = structure(c(10L, 10L, 10L, 10L, 10L,
10L, 10L, 10L, 10L, 10L, 10L, 10L, 10L, 10L, 10L, 10L, 10L, 10L,
10L, 10L), .Label = c("Afghanistan" - deleted countries - "Zimbabwe"),
class = "factor"), year = c("X1984", "X1985", "X1986",
"X1987", "X1988", "X1989", "X1990", "X1991", "X1992", "X1993",
"X1994", "X1995", "X1996", "X1997", "X1998", "X1999", "X2000",
"X2001", "X2002", "X2003"), value = c(NA, NA, NA, NA, NA, NA,
NA, NA, 90.8, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA)),
row.names = c(NA, -20L), class = c("tbl_df", "tbl", "data.frame"))
This is the code for my scatter graph: -
practiceplot <- ggplot(pivoteddata, aes(x=year, y=value, group=country,
color=country, size=10)) +
geom_line() + geom_point()
...and what it looks like: -
I want to change the x-axis values, so added to the code :-
ggplot(pivoteddata, aes(x=year, y=value, group=country,
color=country, size=10)) +
**scale_x_discrete(breaks = c(5, 10, 15, 20, 25, 30, 35),
labels = c("1985", "1990", "1995", "2000", "2005",
"2010", "2015"))**
The new values do not appear on the x-axis. What am I doing wrong?
Thanks