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: plot yline for different values on each sub plot

From   Timothy Colbourn <>
To   Statalist <>
Subject   st: plot yline for different values on each sub plot
Date   Fri, 15 Apr 2011 10:56:20 +0200


I have a bar graph plotted 4 times in one for each different arm of the trial I am analysing: by(arm) 

I have ploted a yline showing the expected number of births in each arm: yline(`=expbirths') which is a reference against the observed births bars plotted for each month (x axis). The problem is that Stata plots the yline on each of the 4 sub plots at the same value - the value for the first sub plot (arm) - rather than at the value for each arm on each subplot. I have tried yline(`=expbirths by(arm)')  but it does the same thing (with no error message - i.e. it essentially ignores the by(arm). The full syntax for the graph is:

graph bar (asis) livebirth stillbirth nnd mvital, over(month, label( labsize(vsmall) angle(90))) ///
	ylabel(0(50)550, labsize(small) angle(0)) yline(`=expbirths (arm)') ytitle("frequency") ///
	by(, title("Births and deaths in each RCT arm", size(small)) note("")) ///
	legend(order(1 "Livebirths" 2 "Stillbirths" 3 "Neonatal Deaths" 4 "Maternal Deaths") size(vsmall)) by(arm)

Is it possible to plot the yline for each value of expbirths on each subplot?


Tim Colbourn
Research Fellow and part-time PhD student,
Centre for International Health and Development,
UCL Institute of Child Health,
30 Guilford Street,

based full-time in Malawi
Tel: Office: +265 1 758 476
       Mobile: +265 888 159 231

*   For searches and help try:

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