Statalist The Stata Listserver


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

RE: st: Re: RE: Special character in a plot's legend


From   "Nick Cox" <[email protected]>
To   <[email protected]>
Subject   RE: st: Re: RE: Special character in a plot's legend
Date   Wed, 24 Jan 2007 17:07:17 -0000

If I may be so bold:

*! 3.14159 24 January 2007 
* Michael Blasnik, Svend Juul, Nick Cox           
program asciiplot 
	version 8 
	preserve 
	clear
	qui set obs 223

	gen asciin = _n + 32
	gen ascii = char(asciin)
	gen x = int(asciin/10)
	gen y = mod(asciin,10)
	
	local scheme "`c(scheme)'"  
	capture set scheme lean1  
 	
	twoway scatter y x , msymbol(i) ///
	  mlab(ascii) mlabpos(0) mlabsize(large) ///
	  ylabel(0(1)9 , nogrid notick) ymticks(-0.5(1)9.5 , grid) ///
	  ytitle("Last Digit") ysc(reverse) ///
	  xaxis(1 2) xtitle("First Digit(s) of ASCII Code", axis(2)) ///
	  xlabel(3(1)25, axis(2) nogrid notick) ///
	  xmticks(2.5(1)25.5, axis(2) grid) ///
	  xscale(off axis(1)) ///
	  xsize(6) ysize(4) plotregion(margin(zero))
	
	set scheme `scheme' 
end 

This doesn't destroy data in memory, and doesn't fail
if for some unfathomable reason you have not yet installed
scheme -lean1-. 

Nick 
[email protected] 

Svend Juul
 
> Michael wrote:
>  
> I just wanted to add to this by repeating a little code 
> I posted last month to address this issue of special characters
> that makes it quite simple to find the ASCII code for the
> character you want and doesn't require changing the results
> window font to match the graph window font.
> --------------------------------------------------------------
>  
> Michael's graph is a beauty. I think, however, that the
> following is even prettier.
>  
> Svend
>  
> clear
> set obs 223
> gen asciin=_n+32
> gen ascii=char(asciin)
> gen x=int(asciin/10)
> gen y=mod(asciin,10)
>  
> set scheme lean1  // ( -findit lean scheme- )
>  
> twoway scatter y x , msymbol(i) ///
>   mlab(ascii) mlabpos(0) mlabsize(large) ///
>   ylabel(0(1)9 , nogrid notick) ymticks(-0.5(1)9.5 , grid) ///
>   xlabel(3(1)25 , nogrid notick) xmticks(2.5(1)25.5 , grid) ///
>   xtitle("First Digit(s) of ASCII Code") ///
>   ytitle("Last Digit") ///
>   xsize(6) ysize(4) plotregion(margin(zero))

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