Notice: On March 31, it was **announced** that Statalist is moving from an email list to a **forum**. The old list will shut down on April 23, and its replacement, **statalist.org** is already up and running.

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

From |
"G. Dai" <dgecon@gmail.com> |

To |
statalist@hsphsun2.harvard.edu |

Subject |
Re: st: how to draw a timeline bar failure figure. |

Date |
Fri, 25 Nov 2011 21:39:17 -0700 |

It does exactly what I want. Thank you, Nick. G. On Fri, Nov 25, 2011 at 1:31 AM, Nick Cox <njcoxstata@gmail.com> wrote: > Good clear question. Consider > > gen id = _n > > labmask id, values(machine_id) > > twoway rbar fail_b fail_e id, horizontal barw(0.2) yla(1/5, ang(h) > val) || /// > scatter id fail_e, ms(none) mla(fail_r) mlabpos(12) mlabgap(*4) legend(off) > > where -labmask- is from SJ, i.e. -search labmask- will show > > SJ-8-2 gr0034 . . . . . . . . . . Speaking Stata: Between tables and graphs > (help labmask, seqvar if installed) . . . . . . . . . . . . N. J. Cox > Q2/08 SJ 8(2):269--289 > outlines techniques for producing table-like graphs > > with clickable download location. > > On Thu, Nov 24, 2011 at 11:37 PM, G. Dai <dgecon@gmail.com> wrote: > >> To make my question easier to understand, let's take the following date: >> ************data begins******* >> clear >> set obs 5 >> gen machine_id="" >> replace machine_id="A" in 1 >> replace machine_id= "A" in 2 >> replace machine_id= "B" in 3 >> replace machine_id= "B" in 4 >> replace machine_id= "C" in 5 >> >> gen fail_begin_hour=. >> replace fail_begin_hour=0 in 1 >> replace fail_begin_hour=15 in 2 >> replace fail_begin_hour=3 in 3 >> replace fail_begin_hour=16 in 4 >> replace fail_begin_hour=9 in 5 >> >> gen fail_end_hour=. >> replace fail_end_hour=15 in 1 >> replace fail_end_hour=21 in 2 >> replace fail_end_hour=13 in 3 >> replace fail_end_hour=24 in 4 >> replace fail_end_hour=17 in 5 >> >> gen fail_reason="" >> replace fail_reason="Unhappy" in 1 >> replace fail_reason="Nothappy" in 2 >> replace fail_reason="Happy" in 3 >> replace fail_reason="Very happy" in 4 >> replace fail_reason="Too Happy" in 5 >> ********data ends*************** >> In this dataset, I have four variables and five obs. It tells which >> machin_id fails at which time period (from fail_begin_hour to >> fail_end_hour) because of the fail_reason. >> >> What I'm trying to do is to draw a 'bar' graph with hours from 0 to 24 >> as the X axis, and the machine_ID on the Y-axis, showing the time >> interval when the corresponding machine is failed. And better, I want >> to show the reason of the fail just above the 'bar'. >> >> This seems an unusual figure, so any suggestions are appreciated. > > * > * 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/

**References**:**st: how to draw a timeline bar failure figure.***From:*"G. Dai" <dgecon@gmail.com>

**Re: st: how to draw a timeline bar failure figure.***From:*Nick Cox <njcoxstata@gmail.com>

- Prev by Date:
**Re: st: bootstrap weights** - Next by Date:
**st: what is the command that used to be "outreg" in the old version** - Previous by thread:
**Re: st: how to draw a timeline bar failure figure.** - Next by thread:
**st: Course on Structural Equation Modeling using STATA 12 (Canbera, Australia 16-20 January)** - Index(es):