cancel
Showing results for 
Search instead for 
Did you mean: 
Data Engineering
cancel
Showing results for 
Search instead for 
Did you mean: 

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?

1 ACCEPTED SOLUTION

Accepted Solutions

sdaza
New Contributor III

Try something like this:

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

View solution in original post

2 REPLIES 2

sdaza
New Contributor III

Try something like this:

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

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 

Welcome to Databricks Community: Lets learn, network and celebrate together

Join our fast-growing data practitioner and expert community of 80K+ members, ready to discover, help and collaborate together while making meaningful connections. 

Click here to register and join today! 

Engage in exciting technical discussions, join a group with your peers and meet our Featured Members.