Comments (8)
You want to control the colors on each curve? try this:
p1 <- autoplot(survival_obj)
p1 <- p1 + scale_colour_manual(values = c('indianred2','seagreen'))
I was having the same problem and when debugging found that it uses geom_step function and this is how to control the colors :)
Despite all this, I think the implementation on ggfortify should be more clear on that option or corrected.
Cheers
from ggfortify.
@averissimo thx for the reply. It is correct that we should specify multi colors like ggplot2
does.
Maybe better to update the doc.
@DarioS Sorry to late reply, I missed the notification.
from ggfortify.
I think that it would be better to provide abstraction of this to the end-user, as the function currently tries to do unsuccessfully. The underlying ggplot2 framework should be hidden away where possible.
from ggfortify.
OK, will consider the fix.
from ggfortify.
@DarioS I'm guessing that you want to make all lines red regardless of which group they are. Am I correct?
from ggfortify.
Actually, it would be desirable to specify one colour per factor level. I only used "red"
because the surv.colour
option doesn't allow a vector of values.
> library(survival)
> autoplot(survfit(Surv(time, status) ~ sex, data = lung), surv.colour = c("red", "blue"))
Error: Aesthetics must be either length 1 or the same as the data (208): colour
Note that the number of samples in the error message is wrong.
> dim(lung)
[1] 228 10
from ggfortify.
I will take a look tomorrow. I think the issue is with the way that geom_factory()
works. Am I right @sinhrks ? I likely fix would for geom_factory()
to check if the column exists in the data if not, check if it is a valid colour.
from ggfortify.
A pull request for fixing this would be appreciated! @lselzer @DarioS @averissimo
from ggfortify.
Related Issues (20)
- Typo: "Contasnst" instead of "Constant" in autoplot.lm() HOT 1
- ggfortify + tidymodels HOT 6
- ggfortify fails with dev scales HOT 5
- Feature request: a method for the objects obtained from lmer, glmer of package lme4
- how to change the confidence level HOT 7
- documentation not ideal: autoplot extension for PCA objects HOT 1
- autoplot.lm(which = 2) fails when residuals have class AsIs HOT 1
- Travis CI failing HOT 1
- autoplot.lm() uses deprecated dplyr::arrange_() HOT 8
- CITATION info wrong/incomplete HOT 1
- Possible issue adding labels to certain plots HOT 4
- Loadings cutoff option (PCA) HOT 7
- Error with autoplot on a survfit object with multiple stratifying variables HOT 3
- no x/y labels with ggdistribution plots HOT 12
- ggrepel not working with new version of R and RStudio HOT 2
- PCA score results are different HOT 3
- Enhancement: Patients At Risk Table Below Survival Plot HOT 2
- "colour" vs "color" when calling autoplot on a PCA HOT 1
- Saving error with ggsave for autoplot() similiar to #98
- `n.risk` at `time == 0` is not correct when `nlevels(strata) > 1` in `fortify.survfit(*, surv.connect = TRUE)` HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from ggfortify.