# make sure the figure width is no smaller than fig.height
opts_hooks$set(fig.width = function(options) {
if (options$fig.width < options$fig.height) {
options$fig.width = options$fig.height
}
options
})
# remove all hooks
opts_hooks$restore()
Run the code above in your browser using DataLab