Change size or aspect ratio of ggplot visualizations

tismith1_558848
New Contributor

I understand that plots in R notebooks are captured by a png graphics device. Is there a way to set the size or the aspect ratio of the canvas? I understand that I can resize the rendered .png by dragging the handle in the notebook, but that means I have to set font sizes etc manually so that they render nicely at the smaller size. I'd rather just specify the size of my plot in my code. Is this possible?

sdaza
New Contributor III

Try something like this:

options(repr.plot.width=800, repr.plot.height=500)

View solution in original post

kassandra
New Contributor II

Hi @sdaza​ , the answer above didn't change the size somehow, or perhaps I was putting it in the wrong place? I entered it in a new cell before the %sql cell with the plot chart.

screen-shot-2020-12-23-at-104359-pm.png