Bookmark and Share

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

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

st: how to draw a timeline bar failure figure.

From   "G. Dai" <>
To   statalist <>
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*******
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:

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