eg_ggsave: An Example for 'ggplot' with Errorbar

Description Usage Examples

Description

An exmaple.

Usage

1

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
library(R11)
library(ggplot2)
x=c(1,3,8)
y=c(5,6,1)
dat=data.frame(x,y)

ggplot(dat, aes(x = x, y = y)) + geom_line() + theme_bw()
p <- last_plot()
ggsave("plot1.pdf", p, width = 3.15, height = 3.15)
ggsave("plot2.tiff", p, width = 4, height = 3, units="cm", dpi=300)
dev.off()
# ggsave(filename, plot = last_plot(), device = NULL, path = NULL,
#       scale = 1, width = NA, height = NA, units = c("in", "cm", "mm"),
#       dpi = 300, limitsize = TRUE, ...)
### 'device' can be c("eps", "ps", "tex", "pdf", "jpeg", "tiff", "png", "bmp", "svg", "wmf").
###  'units' (of 'width', 'height') can be c("in", "cm", or "mm").
###  'scale' refer to "multiplicative scaling factor".

PhDMeiwp/R11 documentation built on May 20, 2019, 4:25 p.m.