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

From |
"Sergiy Radyakin" <serjradyakin@gmail.com> |

To |
statalist@hsphsun2.harvard.edu |

Subject |
Re: st: How to print in black an interval in an histogram |

Date |
Wed, 23 Apr 2008 11:57:33 -0400 |

Dear Herve, here is an example which might help you: sysuse auto gen price1=price if rep78==1 gen price2=price if rep78==2 gen price345=price if inlist(rep78,3,4,5) graph bar price1 price2 price345, over(rep78) bar(1,color(blue)) bar(2,color(red)) nofill Note 3 things: 1) price is separated into three vars, so that styles can be controlled individually 2) using graph bar instead of histogram, since option -bar- does not apply to histogram for some reason. 3) using -nofill-option to align the bars properly I think you can first compute the frequencies, put them in a small dataset, then plot it similarly to this example. Hope this helps. Best regards, Sergiy On 4/23/08, Herve STOLOWY <stolowy@hec.fr> wrote: > Dear Statalisters: > > I get histograms which represent the distributions of earnings (for levels of earnings between -10% and +10% of assets). I get 20 intervals. Each has a width of 1%. > > I would like to know if there is a possibility to print in black (or a different color or design) the two intervals directly adjacent to zero (which represent the heart of my study). > > I provide below the command lines. (Thanks again to all the replies I received recently and which helped me to be able to get these graphs). > > foreach val in "AUS" "FRA" "GBR" { > > label define post_ifrs2 0 "Pre IFRS" 1 "Post IFRS" > label values post_ifrs post_ifrs2 > distinct name if abs(ib_scaled_w)<.1 & country=="`val'" & sample_sum==1 & post_ifrs==0 > local n0 = r(N) > local n0bis = r(ndistinct) > distinct name if abs(ib_scaled_w)<.1 & country=="`val'" & sample_sum==1 & post_ifrs==1 > local n1 = r(N) > local n1bis = r(ndistinct) > la def `:val label post_ifrs' 0 `"`:label (post_ifrs) 0': `n0' obs."', modify > la def `:val label post_ifrs' 1 `"`:label (post_ifrs) 1': `n1' obs."', modify > > histogram ib_scaled_w if abs(ib_scaled_w)<.1 & country=="`val'" & sample_sum==1, bin(20) by(post_ifrs, note("Number of firms - Pre IFRS: `n0bis' firms, Number of firms - Post IFRS: `n1bis' firms")) title("`val'") saving (hist_`val', replace) > > label drop post_ifrs2 > > } > > graph combine hist_AUS.gph hist_FRA.gph hist_GBR.gph, saving(hist_combine.gph, replace) altshrink > > Best regards > > Herve Stolowy > > > > > > > > > *********************************************************** > Professeur/Professor > President of the French Accounting Association (AFC) > HEC Paris > Departement Comptabilite Controle de gestion / Dept of Accounting and Management Control > 1, rue de la Liberation > 78351 - Jouy-en-Josas > France > Tel: +33 1 39 67 94 42 - Fax: +33 1 39 67 70 86 > mail: stolowy at hec dot fr > web: http://www.hec.fr/stolowy > > * > * 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/

**References**:**st: How to print in black an interval in an histogram***From:*"Herve STOLOWY" <stolowy@hec.fr>

- Prev by Date:
**Re: st: strange global macros** - Next by Date:
**st: Re: Problems with calculating marginal effects for categoricalvariables in ologit models** - Previous by thread:
**st: How to print in black an interval in an histogram** - Next by thread:
**st: ivreg2 again (with aplogies)** - Index(es):

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