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
Related Posts with Equal scaling on Y and X axes
Cox proportional hazards model a non constant covariateDear stata listers I'm using stata to analyse time-to-event data. Specifically, I'm trying to relat…
Adding percentiles to boxplotsHello, I am using this code for boxplots - graph box , /// over(month, relabel()) /// title …
Grab UNCTAD dataStata has a handy package Code: wbopendata to get World Bank's World Development Indicators data …
IVQREG2: module to estimare structural quantile functions now available in SSCDear All: Thanks to Kit Baum, ivqreg2 is now available in SSC. This module estimates the structura…
Stationary residuals. Spurious regression?Greetings Stata Users. I'm trying to estimate the public spending role over economic growth. So bas…
Subscribe to:
Post Comments (Atom)
0 Response to Equal scaling on Y and X axes
Post a Comment