2017-08-03 159 views
5

在jupyter笔记本中使用R,首先我通常设置绘图大小。其次,我想绘制一个不同大小的单一情节。R - 在jupyter中更改ggplot绘图大小

## 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? 

正如你可以看到,我想改变第二个图(只有第二个图)是一个10×8。我该怎么做呢?

对不起,有一个潜在的问题,因为绘图大小在Rstudio中通常不是问题。

回答

4

在这里你去:

library(repr) 
options(repr.plot.width=10, repr.plot.height=8) 
ggplot(iris, aes(x = Sepal.Length, y= Sepal.Width)) + 
    geom_point() 
+0

'库(再版)'一部分是不必要的,我 – eddi