Statalist The Stata Listserver


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

RE: st: dot-dash-plot


From   "Wallace, John" <[email protected]>
To   <[email protected]>
Subject   RE: st: dot-dash-plot
Date   Tue, 20 Feb 2007 16:48:35 -0800

Many thanks to Scott and Maarten for this snippet, which I've already
added to my "widgets" folder.  I've been wanting this graph technique
for years!

John W.

_____________________________________________
Date: Mon, 19 Feb 2007 23:03:17 +0000 (GMT)
From: Maarten buis <[email protected]>
Subject: Re: st: dot-dash-plot

- --- Scott Merryman <[email protected]> wrote:
> Tufte's dot-dash-plot ("The Visual Display of Quantitative
> Information" page 133) could be created as:
> ...Where the idea of -gen pipe = "|".... - is taken from Nick Cox's 
> "Speaking Stata:  Graphing distributions" Stata Journal 4(1)
>
>Scott

Cool,
It might be improved a bit by adding a jitter to mpg:

sysuse auto,clear

gen wherex = 11
gen wherey = 3000
gen pipe = "|"
gen mpgjit = mpg + .4*invnorm(uniform())

twoway scatter mpg price , msize(small) || /// 
	scatter wherex price, ms(none) mlab(pipe) mlabcolor(black) /// 
	mlabpos(0) || ///
	scatter mpgjit wherey , ms(none) mlab(pipe) mlabang(vertical)///

	mlabcolor(black) mlabpos(0) || , ///
	legend(off) yscale(noline) ylabel(none) xscale(noline) ///
        xlabel(none) xtitle(Price)

Maarten

*
*   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