Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ggsurvplot() and axes offset from the origin #196

Closed
kassambara opened this issue Apr 16, 2017 · 5 comments
Closed

ggsurvplot() and axes offset from the origin #196

kassambara opened this issue Apr 16, 2017 · 5 comments

Comments

@kassambara
Copy link
Owner

@kassambara kassambara commented Apr 16, 2017

(User request by e-mail)

ggsurvplot follow the standard R/ggplot convention of having the axes offset from the origin (I have never understood why this is the case – since basic mathematics you always show x=y=0 as the origin). Normally I would get around this by using yaxs="i" in plot, and I believe there is a similar way with expand limits in ggplot, however when I do this, the axis disappears.

Normally it is a bit of an annoyance, but with Kaplan-Meier plots is actually quite critical – after all we want to see when survival hits y=0 – with the values offset and a large number of patients you aren’t sure if it has hit 0, or there is still someone left! Any advice would be great, and even better if the default in the package was changed at the next update, as those who would want it offset must be in a minority i.e. nobody. Also if someone isn’t fussy, they should get the more accurate version!

kassambara added a commit that referenced this issue Apr 28, 2017
kassambara added a commit that referenced this issue Apr 28, 2017
@kassambara
Copy link
Owner Author

@kassambara kassambara commented Apr 28, 2017

This has been fixed now:

library(survival)
library(survminer)

# Basic survival curves
fit<- survfit(Surv(time, status) ~ sex, data = lung)
ggsurvplot(fit, data = lung, risk.table = TRUE,
           tables.theme = theme_cleantable())

rplot09

@kassambara kassambara closed this Apr 28, 2017
kassambara added a commit that referenced this issue May 2, 2017
kassambara added a commit that referenced this issue May 2, 2017
@kassambara
Copy link
Owner Author

@kassambara kassambara commented May 2, 2017

New argument axes.offset added. logical value. Default is TRUE. If FALSE, set the plot axes to start at the origin.

@ShixiangWang
Copy link

@ShixiangWang ShixiangWang commented Jun 4, 2018

Hello, @kassambara How can I make sure the 100% in the figure ?

image

@akirosingh
Copy link

@akirosingh akirosingh commented Dec 3, 2019

@ShixiangWang I was able to fix it by just increasing the y limits. ylim=c(0,1.01)

@ShixiangWang
Copy link

@ShixiangWang ShixiangWang commented Dec 3, 2019

@akirosingh Thanks :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
3 participants
You can’t perform that action at this time.