I am wondering how to configure Jupyter to plot a smaller figure within R kernel.
I have tried using options(repr.plot.width = 1, repr.plot.height = 0.75, repr.plot.res = 300)
, but the result is kinda messy. It is changing the size of the plot R produced. Are there any ways I can directly configure the output graph size in Jupyter.
In other words, how can I change the size in the first figure to the size in the second figure, while not messing up the plot.
Changing the plot size You can change the plot size by setting the option repr. plot. width and repr.
Running R in an R Notebook is a significantly better experience than running R in a Jupyter Notebook. The advantages present in R Notebooks can also provide guidance for feature development in other Notebook software, which improves the data analysis ecosystem as a whole.
You need to manually set the tick size, marker size and text size. The text size and tick size can be set through the theme()
function, while marker size through geom_point()
function.
df_1 = data.frame(x=c(5, 6, 7, 8, 9), y = c(200, 225, 250, 270, 310)) options(repr.plot.width = 1, repr.plot.height = 0.75) ggplot(df_1, aes(x = x, y = y)) + geom_point(size = 0.3) + theme(text = element_text(size = 3), element_line(size = 0.1))
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With