Reputation: 1435
I am interested to produce a plot similar to figure two published in JAMA article found here. I would appreciate any suggestion on how to produce similar figure in R. Sample data is found on this link https://drive.google.com/file/d/0B_4NdfcEvU7LUXB4TW9jWWZPODA/edit?usp=sharing.
Thanks
Upvotes: 0
Views: 363
Reputation: 206197
The sample data is extremely helpful. Thank you.
The simplest ggplot
code would probably be
ggplot(df, aes(x=est, y=interaction(pollut, lag, lex.order=TRUE))) +
geom_point() +
geom_errorbarh(aes(xmin=lcl, xmax=ucl)) + geom_vline(x=0)
which gives
You could start customizing with
ggplot(df, aes(x=est, y=lag)) +
geom_point() +
geom_errorbarh(aes(xmin=lcl, xmax=ucl)) + geom_vline(x=0) +
facet_grid(pollut~.) +
theme(panel.background=element_rect(fill="white"))
Upvotes: 2