This seems so basic and obvious but I can't find a discussion online or in documentation. I want a scatterplot with the same physical scaling on Y and X axes. I've done mca and mcaplot does this, but I want other plots of dimensions. As the ranges of Y and X differ, aspect(1) gives equal length axes but not equal scales. This brute force code gives an approximate solution, but is based on the data values and the plotted axes have an extra space outside the plot area which I think has to be allowed for. Also the axes use rounded (nice) labels which may also affect the scaling. The best solution (to me!) would be a new option "aspect(xyequal)"!
After mca, the coordinates have to be extracted from a matrix:
matrix A=e(A)
svmat2 A, names(dim1 dim2 dim3) rnames(varnam) full
qui sum dim1
scalar xhi=r(max)
scalar xlo=r(min)
qui sum dim2
scalar yhi=r(max)
scalar ylo=r(min)
local asrat=(yhi-ylo)/(xhi-xlo)
scatter [lots omitted] ... aspect(`asrat')
Allan
0 Response to Equal scaling on Y and X axes
Post a Comment