In setting the scales of my ggplot, I need to specify max
and min
values.
Now everything works fine if I specify the path directly (e.g x$column
), but I would like it to take an argument containing the path, how can this be achieved?
Code
SMAcolName <- colnames(ov.indicators)[grep("SMAPrice", names(ov.indicators))]
SMAsourceName <- paste0("ov.indicactors$", SMAcolName)
line.SMAsqrmPrice <- ggplot(data = fortify(ov.indicators), aes_string( x = "published", y = SMAcolName )) +
geom_line() +
scale_y_continuous(breaks = c(seq(10000, max(SMAsourceName, na.rm = TRUE), by = 5000) )) +
The above code gives an error, but demonstrates what I'm trying to achieve.