I am creating a series of plots like so:
data_subset <- df_order
#Hier wird eine Spalte hinzugefügt die sich nur auf das Jahr bezieht, damit werden die Daten dann auf der X-Achse abgebildet
data_subset$Year <- format(data_subset$DateAsDate, "%Y")
plotdf <- ddply(data_subset,.(Year, Sex),
function(zz){
#Sämtliche Daten hier werden pro Jahr und Geschlecht aufgetragen.
data.frame(
rownum=nrow(zz)
)
}
)
library(reshape2)
library(reshape)
meltdf <- melt(plotdf, id=c("Year", "Sex"))
meltdf$Dicipline <- substr(meltdf$variable, 1, nchar(as.character(meltdf$variable))-3)
meltdf$variable <- substr(meltdf$variable, nchar(as.character(meltdf$variable))-2, nchar(as.character(meltdf$variable)))
meltdf %>% ggplot(aes(x = Year, y = value, colour = variable, group = variable)) +
geom_line() + facet_grid(Sex~Dicipline) + labs(x="Jahr", y="Anzahl Teilnahmen")
#ggplot(plotdf, aes(x = Year)) + geom_line(aes(y = xmin)) + geom_line(aes(y = xmed)) + labs(x="Jahr", y="Gewichtswerte")
It plots the number of values of my data frame per year separated by Sex, and it works fine, but the x-Axis looks very crammed, since I have data from the 1960s until today.
How can I reduce the number of labels on the x-Axis, so that e.g. only every 10th year is printed below the axis?