Bookmark and Share

Notice: On April 23, 2014, Statalist moved from an email list to a forum, based at statalist.org.


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

Re: st: questions about histogram


From   Ulrich Kohler <[email protected]>
To   [email protected]
Subject   Re: st: questions about histogram
Date   Tue, 21 Sep 2010 17:42:17 +0200

-graph twoway- often provides proper solutions for difficult
graph-problems. Here is a starter:


---------------------------------------------------------
clear
set mem 100m
sysuse auto
bys foreign: g counter = _n
contract counter 

graph twoway ///
  || bar _freq counter, ///
  || scatter _freq counter if mod(counter,2)==0 ///
     , ms(i) mlab(_freq) mlabpos(12) ///
  || , yscale(range(0 2.5)) ylab(0(1)2) legend(off)
  
------------------------------------------------------------


  

Am Dienstag, den 21.09.2010, 10:23 -0500 schrieb David Souther:
> <<
> 
> I'm having trouble with 2 elements in a histogram.
> 
> The first issue is that  I cannot prevent the last bin from combining
> the frequency/percent of the highest x axis categories.
> 
> The second issues is that  I would like to just add labels to some of
> the bins--not all of them, it's too cluttered that way.  Here's an
> example script of what I'm talking about
> 
> clear
> set mem 100m
> sysuse auto
> bys foreign: g counter = _n
> tab counter for
> 
> *!! notice how there is only a frequency of 1 for the last bin at 52,
> but no matter how large I make the xscale , it always combines these
> last two into the last bin with width set to 1.
> 
> hist counter   , normal  addl width(1)  start(1) freq  ///
> normopts(lcolor(dimgray))   xscale(range(1 100)) yscale(range(1 4)) ///
> plotregion(margin(small)) graphregion(margin(vsmall))
> addlabopts(mlabsize(small) mlabangle(forty_five)) ylabel(minmax)
> 
> *
> *   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/


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


© Copyright 1996–2018 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   Site index