Statalist The Stata Listserver

[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]

st: Graph axis labelling range

From   Nick Winter <>
To   Stata List <>
Subject   st: Graph axis labelling range
Date   Mon, 19 Feb 2007 15:02:23 -0500


I am trying to create a "range-frame" around a scatterplot (see Tufte, Visual Display of Quantitative Information, pp 130-131). The basic idea is that the axis line is drawn only for the range of the data.

I've managed to create it (for the y-axis only in this example) as follows:

. sysuse auto

. graph twoway scatter mpg price || ///
scatteri 12 -250 41 -250, c(l) msym(none) , ///
plotregion(margin(l 0 b 0)) yscale(noline) ///
ylab(12 41, nogrid) xscale(ra(-200 15000)) ///
legend(off) yscal(ra(10 45))

But this seems like a pretty ugly way to go (and requires some ad-hoc tinkering).

I'd have thought that the yscale(noextend) option would get me where I want to go, but this command:

. graph twoway scatter mpg price , yscale(noextend)

draws a y-axis that runs from about 15.5 to 26.2. Not sure why that's happening.

Is this something someone has programmed, or on which someone has a better approach?

Nick Winter

Nicholas Winter 434.924.6994 t
Assistant Professor 434.924.3359 f
Department of Politics e
University of Virginia w
PO Box 400787, 100 Cabell Hall
Charlottesville, VA 22904

* For searches and help try:

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