Statalist The Stata Listserver


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

Re: st: RE: Graph axis labelling range


From   Nick Winter <[email protected]>
To   [email protected]
Subject   Re: st: RE: Graph axis labelling range
Date   Tue, 20 Feb 2007 13:32:39 -0500

Yes,

but still no ability to extend, say, the y-axis to run from 0 to 50, but with the axis line only drawn for the data range . . .

Steichen, Thomas J. wrote:

A nice cross between my proposal and Scott's is
twoway scatter mpg price, ylabel(minmax,nogrid) /// xlabel(minmax) yscale(nofextend) xscale(nofextend) plotregion(lcol(none))

This is clean and simple but gives the default gap.

Tom

-----------------------------------
Thomas J. Steichen
[email protected]
-----------------------------------
-----Original Message-----
From: [email protected] [mailto:[email protected]] On Behalf Of Nick Winter
Sent: Tuesday, February 20, 2007 12:34 PM
To: [email protected]
Subject: Re: st: RE: Graph axis labelling range

Yes, that gives a version of what I'm looking for. I also want to be able to extend the range of the axis, yet also retain the ability to have the axis line only extend over a defined range. For that, I think I need an approach along the lines of what I was doing, as made more elegant by Thomas Steichen.

(That is, doing something like yscale(ra(0 50)) then means that the nofextend draws the axis from 0 to 50.)

A question for Statacorp, perhaps: is there a way to extract programmatically the size of the default gap between the axis and the data area, from the current scheme?

--Nick

Scott Merryman wrote:

How about this:

twoway scatter mpg price, ylabel(minmax,nogrid) /// xlabel(minmax) yscale(nofextend) xscale(nofextend)


Scott



-----Original Message-----
From: [email protected] [mailto:owner-
[email protected]] On Behalf Of Nick Winter
Sent: Monday, February 19, 2007 2:02 PM
To: Stata List
Subject: st: Graph axis labelling range

Hi,

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?

Thanks
Nick Winter

--
--------------------------------------------------------------
Nicholas Winter                                 434.924.6994 t
Assistant Professor                             434.924.3359 f
Department of Politics                  [email protected] e
University of Virginia          faculty.virginia.edu/nwinter w
PO Box 400787, 100 Cabell Hall
Charlottesville, VA 22904

*
*   For searches and help try:
*   http://www.stata.com/support/faqs/res/findit.html
*   http://www.stata.com/support/statalist/faq
*   http://www.ats.ucla.edu/stat/stata/
*
*   For searches and help try:
*   http://www.stata.com/support/faqs/res/findit.html
*   http://www.stata.com/support/statalist/faq
*   http://www.ats.ucla.edu/stat/stata/

--
--------------------------------------------------------------
Nicholas Winter                                 434.924.6994 t
Assistant Professor                             434.924.3359 f
Department of Politics                  [email protected] e
University of Virginia          faculty.virginia.edu/nwinter w
PO Box 400787, 100 Cabell Hall
Charlottesville, VA 22904

*
*   For searches and help try:
*   http://www.stata.com/support/faqs/res/findit.html
*   http://www.stata.com/support/statalist/faq
*   http://www.ats.ucla.edu/stat/stata/



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