Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Set exact graph limits

Tags:

stata

Suppose I want to graph some data and I want to set a specific range on the x-axis, like so:

sysuse auto, clear
scatter mpg price, xlabel(3000[1000]16000)

Stata seems to be interpreting this command to mean that I want roughly those limits and leaves a bit of extra space on the left and the right of those numbers. Is there any way to get rid of this extra space and to make graph cut off exactly at these numbers?

like image 982
RoyalTS Avatar asked Feb 18 '26 19:02

RoyalTS


1 Answers

Normally I would direct you to the options xscale() and yscale(), but in your example what you are seeing is nothing to do with that. By default Stata adds a bit of space around the plotregion but you can remove it with the extra option

plotregion(margin(zero))
like image 192
Nick Cox Avatar answered Feb 20 '26 23:02

Nick Cox



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!