In this example, the two measures to be included in the same graph are cholesterol ("chol") and insulin resistance ("lnIR"). Note that because lnIR is a log transformation, this measure has negative values.
MY QUESTION: I cannot seem to make adjustments to the formatting of second of the two y-axes. When I specify an axis title, the title goes to the wrong axis. When I specify a height suboption for the title, the height suboption is applied to the first axis only. I have tried inserting the additional suboption yaxis(#) within the "ytitle" option, but that hasn't worked so far. I've been scouring manuals and older postings but have not found an answer yet.
Code:
separate chol, by(diet) separate lnIR, by(diet) collapse (mean) chol1 chol2 lnIR1 lnIR2, by(diet visit) graph twoway /// (line chol1 visit, yaxis(1) ytitle("Mean Cholesterol", height(5)) ylabel( , labsize(small))) /// (line lnIR1 visit, yaxis(2) ytitle("Mean Ln IR", height(5)) ylabel( , labsize(small))), /// legend(off) graphregion(color(white)) note("") graph export twoway_example.png
Could you please assist? Also, any other suggestions about how to approach this graph are welcome! Ideally, for example, I would use an estimation function that would allow me to display confidence intervals. Also, I'd like to display the other two lines, associated with the second of the two diets, alongside the first. I suppose if I use combine graph I could show them side-by-side.
Thank you in advance for your assistance.
Lois
0 Response to Graph Twoway with Two Y-Axes: Fine Tuning Formatting
Post a Comment