[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

From |
Hiroyuki Kawakatsu <hkawakat@gmail.com> |

To |
statalist@hsphsun2.harvard.edu |

Subject |
Re: st: how to remove axis margin from plot |

Date |
Sat, 14 Feb 2009 14:40:10 +0000 |

> Friedrich Huebler wrote: > > You can evaluate the range of the variables in your graph within the > do-file to identify appropriate labels. > > . sysuse auto > . sum weight, meanonly > . local xmin = floor(r(min) / 500) * 500 > . local xmax = ceil(r(max) / 500) * 500 > . sum mpg, meanonly > . local ymin = floor(r(min) / 5) * 5 > . local ymax = ceil(r(max) / 5) * 5 > . scatter mpg weight, xscale(r(`xmin' `xmax')) > xlabel(`xmin'(500)`xmax') yscale(r(`ymin' `ymax')) > ylabel(`ymin'(5)`ymax') > > I selected the values 5 and 500 after visual inspection of the data. > You can also write code that specifies appropriate steps for the axis > labels based on the difference between the maximum and minimum values > of a variable. The values in the example above would then be replaced > by two additional macros, e.g. `xstep' instead of 500 and `ystep' > instead of 5. Yes, it's good to know that it is doable. But my point is that the user should not need to do all this extra work just to turn off the extra margin, without having to know the (usually reasonably good) default label positions in the interior of the axis. (Why would one want to turn off the extra margins? In my real application, the x-axis is a %tc variable and it adds way too much margin, presumably because the %tc variable measured in milliseconds are huge numbers, extending the axis into the next day.) h. -- +--- | Hiroyuki Kawakatsu | Business School, Dublin City University | Dublin 9, Ireland. Tel +353 (0)1 700 7496 * * For searches and help try: * http://www.stata.com/help.cgi?search * http://www.stata.com/support/statalist/faq * http://www.ats.ucla.edu/stat/stata/

**References**:**Re: st: how to remove axis margin from plot***From:*Hiroyuki Kawakatsu <hkawakat@gmail.com>

- Prev by Date:
**Re: st: WinEdt+Stata+unix** - Next by Date:
**st: re: Tiao-Goldberger test** - Previous by thread:
**Re: st: how to remove axis margin from plot** - Next by thread:
**st: Averaging coefficients across datasets** - Index(es):

© Copyright 1996–2022 StataCorp LLC | Terms of use | Privacy | Contact us | What's new | Site index |