How can I modify the adjust parameter of an existing plot? For example,
library(ggplot2)
specialPlot <- function(data, colours = c("red", "blue"))
{
ggplot(data, aes(x = values, colour = groups)) +
stat_density(aes(y = ..density..), geom = "path", position = "identity") +
scale_colour_manual("Group", values = c("red", "blue"))
}
aTable <- data.frame(values = rnorm(100), groups = sample(LETTERS[1:2], 100, replace = TRUE))
thePlot <- specialPlot(aTable)
Now that the plot has been assigned to the variable thePlot, how can I make the bandwidth twice as large as the automatically-chosen bandwidth value by modifying thePlot, but not the function specialPlot, because the plotting function might be from a R package which I am not the author of?