WUA_table<-WUA.df[,2:dim(WUA.df)[2]] WUA_discharge<-WUA.df[,1] colour_scheme<-palette(rainbow(dim(WUA_table)[2]))
# Main scatterplot p1 <- ggplot(NULL, aes(WUA_discharge,WUA_table)) + geom_line() + scale_color_manual(values=colour_scheme)+ scale_x_continuous(expand = c(0, 0)) + scale_y_continuous(expand = c(0, 0)) + expand_limits(y = c(min(WUA_table) - .1*diff(range(WUA_table)), max(WUA_table) + .1*diff(range(WUA_table)))) + expand_limits(x = c(min(WUA_discharge) - .1*diff(range(WUA_discharge)), max(WUA_discharge) + .1*diff(range(WUA_discharge)))) + theme(plot.margin= unit(c(0, 0, 0.5, 0.5), "lines")) # Get the gtables gt1 <- ggplot_gtable(ggplot_build(p1)) the error message from the following code states: Error: Aesthetics must either be length one, or the same length as the dataProblems:WUA_table the error appears after the line: gt1 <- ggplot_gtable(ggplot_build(p1)) I would appreciate some help on the matter, it seems like a small fix, however I am very inexperienced with R! [[alternative HTML version deleted]] ______________________________________________ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.