R - 在jupyter中更改ggplot绘图大小

Tre*_*eha 16 r ggplot2 jupyter

在jupyter笔记本中使用R,首先我普遍设置绘图大小.其次,我想绘制一个不同大小的单个地块.

## load ggplot2 library
library("ggplot2")
## set universal plot size:
options(repr.plot.width=6, repr.plot.height=4)

## plot figure. This figure will be 6 X 4
ggplot(iris, aes(x = Sepal.Length, y= Sepal.Width))   +  geom_point() 

## plot another figure. This figure I would like to be 10X8
ggplot(iris, aes(x = Sepal.Length, y= Sepal.Width))   +  geom_point() + HOW DO i CHANGE THE SIZE?
Run Code Online (Sandbox Code Playgroud)

如您所见,我想将第二个图(并且只有第二个图)更改为10X8.我该怎么做呢?

对于一个可能很愚蠢的问题感到抱歉,因为情节调整通常不是Rstudio中的问题.

Wil*_*ler 10

干得好:

library(repr)
options(repr.plot.width=10, repr.plot.height=8)
ggplot(iris, aes(x = Sepal.Length, y= Sepal.Width)) +
    geom_point()
Run Code Online (Sandbox Code Playgroud)

  • “图书馆(代表)”部分对我来说是不必要的 (2认同)