cancel
Showing results for 
Search instead for 
Did you mean: 
Data Engineering
Join discussions on data engineering best practices, architectures, and optimization strategies within the Databricks Community. Exchange insights and solutions with fellow data engineers.
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 

Join 100K+ Data Experts: Register Now & Grow with Us!

Excited to expand your horizons with us? Click here to Register and begin your journey to success!

Already a member? Login and join your local regional user group! If there isn’t one near you, fill out this form and we’ll create one for you to join!