Skip to content

Instantly share code, notes, and snippets.

@CnrLwlss
Created November 30, 2016 16:20
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save CnrLwlss/304871d8006e3a23c69a672f71f28983 to your computer and use it in GitHub Desktop.
Save CnrLwlss/304871d8006e3a23c69a672f71f28983 to your computer and use it in GitHub Desktop.
Get best size for graphics array (array dimension that is most perfectly filled by correlation plots) when plotting possible pairwise combinations of variables against each other.
fdefpairs=t(combn(fdefs,2))
npairs=dim(fdefpairs)[1]
a=round(sqrt(npairs))
if((a+1)*(a+1)>=npairs) mfrow=c(a+1,a+1)
if((a+1)*a>=npairs) mfrow=c(a,a+1)
if(a*a>=npairs) mfrow=c(a,a)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment