Automatically find the best figure dimensions in R ggplot2?

Viewed 135

I am producing many different plots in rmakrdown using ggplot2 and don't want to manually edit their fig.width() ; fig.height() or fig.asp() one by one.

Some plots have large width but small heights (e.g. timeseries), while some have big heights but small width (e.g. violin plots).

Is there a way to display and save plots with the most appropriate dimensions automatically?

I am aware that the "best" figure dimensions might be subjective but maybe there's a way to standardise this? For example by comparing the x (width) and y (height) axis summary statistics (min, max, IQR, sd), the axis with the highest spread might require the biggest dimension?

Thanks

0 Answers
Related