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
Tabulate categories from string variableI have a variable that lists multiple categories, separated by a comma. I would like to create a lis…
Replace function- no real changes issueI have been using the syntax format below to replace the data in the columns with the relevant med_c…
Resources/Road map for learning regular expressions with StataI’ve seen many contributors here (including Andrew Musau William Lisowski Bjarte Aagnes Ali Atia to …
Regression Discontinuity design in stataHi there, I am trying to run a regression discontinuity on the following dataset: Code: * Example…
Cross Section AnalysisHello everyone Apologies for the beginner's question, but I am struggling with simple cross-section…
Subscribe to:
Post Comments (Atom)
0 Response to Equal scaling on Y and X axes
Post a Comment