Bookmark and Share

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]

st: how to draw a timeline bar failure figure.


From   "G. Dai" <dgecon@gmail.com>
To   statalist <statalist@hsphsun2.harvard.edu>
Subject   st: how to draw a timeline bar failure figure.
Date   Thu, 24 Nov 2011 16:37:03 -0700

Deal listers,
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.
G.
*
*   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–2014 StataCorp LP   |   Terms of use   |   Privacy   |   Contact us   |   Site index