title: In Stata, how can I programmatically specify the same ranges of axes?
body: <p>I'm trying to take control over axes of a scatterplot in Stata. Consider an example:</p>
  
  <pre><code>sysuse auto
  twoway (scatter mpg turn), aspectratio(1)
  </code></pre>
  
  <p>I get the following graph:</p>
  
  <p><img src="https://i.stack.imgur.com/ckM8hm.png" alt="enter image description here"></p>
  
  <p>I would like both of the axes to span the same range. Manually this can be achieved by:</p>
  
  <pre><code>twoway (scatter mpg turn), aspectratio(1) yscale(r(10 50)) xscale(r(10 50))
  </code></pre>
  
  <p><img src="https://i.stack.imgur.com/PXavLm.png" alt="enter image description here"></p>
  
  <p>My task is now to generate series of graphs that will are part of dynamic LaTeX document so I would like to skip the step of manual adjustment of the scales. How could I implement that?</p>
  
  <p>I was thinking about using Stata's locals to get a hold of min and max values from both variables somehow (I cannot tell a priori which variable/axis has largest/smallest value) but perhaps there is a smarter solution to tackle this problem?</p>