hugo_memorise_plot.Rd
Saves a plot in the directory chosen at the beginning of the current Hugo Investigation in the subfolder 'gallery' in .rda file with miniatures in pdf and png, what makes plot easier to search
hugo_memorise_plot(plot = NA, name = NULL)
plot | plot to be saved, created with package graphics or ggplot2 |
---|---|
name | character string, name of plot, if NULL then plots will be saved as "plot" with next numbers |
When plot to save is created with more then one funkction from package graphics, the whole block of code should be putted to the function in bracket '...'.
# NOT RUN { # saving plot created with package graphics with a given name hugo_memorise_plot(plot(1:10), "nice_plot") # saving plot created with package graphics without argument name hugo_memorise_plot(plot(1:10, las = 1)) # if plot is created with more then one function from package graphics hugo_memorise_plot({plot(1:10) abline(a = 1, b = 1)}) # creating and saving plot with ggplot2 df <- data.frame(gp = factor(rep(letters[1:3], each = 10)),y = rnorm(30)) require(ggplot2) plot_gg <- ggplot(df, aes(gp, y)) + geom_point() hugo_memorise_plot(plot_gg, "plot_with_ggplot") # also works: hugo_memorise_plot(ggplot(df, aes(gp, y)) + geom_point()) # }