Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

R - Changing ggplot plot size in jupyter

Tags:

People also ask

How do I change the plot size in Jupyter notebook R?

Changing the plot size You can change the plot size by setting the option repr. plot. width and repr.

How do I increase the width of a ggplot2?

To increase the width of axes (both X-axis and Y-axis at the same time) using ggplot2 in R, we can use theme function with axis. line argument where we can set element_line argument to a larger value.


Using R in a jupyter notebook, first I set the plot size universally. Second, I would like to plot one single plot with a different size.

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

As you can see, I would like to change the second plot (and only the second plot) to be a 10X8. How do I do this?

Sorry for a potentially dumb question, as plot sizing is typically not an issue in Rstudio.