hugo_memorise_plot: Save plot

Description Usage Arguments Details Author(s) Examples

Description

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

Usage

1

Arguments

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

Details

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 '...'.

Author(s)

Joanna Golawska

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
## 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())

## End(Not run)

hugo4r/hugo documentation built on May 29, 2019, 11:05 p.m.