I've been tweaking some lines, from a thread a few weeks ago, trying to get a decent kaplan-meier curve with numbers at risk printed below the x-axis.
Two things I'd welcome suggestions on (1) lining up the numbers at risk with the time points on the k-m curve - it doesn't look to bad on the screen, but doesn't look right when saved as a pdf and (2) there's a white box around the legend which I can't seem to figure out how to remove - unless there are other suggestions to prettify the legend.
I'm trying to generalise as much as possible and minimise on data dependent tweaking so that the code would be useable with minimal changes for different datasets.
Thanks
Gary
The code to reproduce the figure is
library(ggplot2) require(survival)
fit <- survfit(Surv(time, status) ~ rx, data = colon)
--------------------------------------------------------------- Dr Gary S Collins Tel: +44 (0)1865 284418 Centre for Statistics in Medicine Fax: +44 (0)1865 284424 Wolfson College Annexe www.csm-oxford.org.uk University of Oxford Linton Road Oxford, OX2 6UD ---------------------------------------------------------------
You can use opts(legend.background = theme_blank()) to remove the white box
around the legend:
mmplot(p+opts(legend.background = theme_blank()), data_table)
On Fri, May 8, 2009 at 3:30 PM, Gary Collins <collins...@gmail.com> wrote:
> I've been tweaking some lines, from a thread a few weeks ago, trying to
> get a decent kaplan-meier curve with numbers at risk printed below the
> x-axis.
> Two things I'd welcome suggestions on (1) lining up the numbers at risk
> with the time points on the k-m curve - it doesn't look to bad on the
> screen, but doesn't look right when saved as a pdf and (2) there's a
> white box around the legend which I can't seem to figure out how to
> remove - unless there are other suggestions to prettify the legend.
> I'm trying to generalise as much as possible and minimise on data
> dependent tweaking so that the code would be useable with minimal
> changes for different datasets.
> Thanks
> Gary
> The code to reproduce the figure is
> library(ggplot2)
> require(survival)
> fit <- survfit(Surv(time, status) ~ rx, data = colon)
> ---------------------------------------------------------------
> Dr Gary S Collins Tel: +44 (0)1865 284418
> Centre for Statistics in Medicine Fax: +44 (0)1865 284424
> Wolfson College Annexe www.csm-oxford.org.uk > University of Oxford
> Linton Road
> Oxford, OX2 6UD
> ---------------------------------------------------------------