Skip to content

Commit

Permalink
Apply automatic stylistic changes
Browse files Browse the repository at this point in the history
  • Loading branch information
github-actions[bot] committed Apr 16, 2024
1 parent 38bb977 commit 7114224
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 15 deletions.
16 changes: 9 additions & 7 deletions R/jskm.R
Original file line number Diff line number Diff line change
Expand Up @@ -380,20 +380,22 @@ jskm <- function(sfit,
geom_step(data = subset(df, time >= cut.landmark), linewidth = linewidth) + geom_step(data = subset(df, time < cut.landmark), linewidth = linewidth)
}

brewer.palette <- c("BrBG", "PiYG", "PRGn", "PuOr", "RdBu", "RdGy", "RdYlBu", "RdYlGn", "Spectral", "Accent", "Dark2", "Paired", "Pastel1", "Pastel2",
"Set1", "Set2", "Set3", "Blues", "BuGn", "BuPu", "GnBu", "Greens", "Greys", "Oranges", "OrRd", "PuBu", "PuBuGn", "PuRd", "Purples",
"RdPu", "Reds", "YlGn", "YlGnBu", "YlOrBr", "YlOrRd")

brewer.palette <- c(
"BrBG", "PiYG", "PRGn", "PuOr", "RdBu", "RdGy", "RdYlBu", "RdYlGn", "Spectral", "Accent", "Dark2", "Paired", "Pastel1", "Pastel2",
"Set1", "Set2", "Set3", "Blues", "BuGn", "BuPu", "GnBu", "Greens", "Greys", "Oranges", "OrRd", "PuBu", "PuBuGn", "PuRd", "Purples",
"RdPu", "Reds", "YlGn", "YlGnBu", "YlOrBr", "YlOrRd"
)

if (!is.null(theme) && theme == "jama") {
col.pal <- c("#00AFBB", "#E7B800", "#FC4E07")
col.pal <- rep(col.pal, ceiling(length(ystratalabs)/3))
col.pal <- rep(col.pal, ceiling(length(ystratalabs) / 3))
} else if (all(linecols %in% brewer.palette)) {
col.pal <- NULL
} else {
col.pal <- linecols
col.pal <- rep(col.pal, ceiling(length(ystratalabs)/length(linecols)))
col.pal <- rep(col.pal, ceiling(length(ystratalabs) / length(linecols)))
}

if (is.null(col.pal)) {
p <- p + scale_colour_brewer(name = ystrataname, palette = linecols)
} else {
Expand Down
18 changes: 10 additions & 8 deletions R/svyjskm.R
Original file line number Diff line number Diff line change
Expand Up @@ -317,26 +317,28 @@ svyjskm <- function(sfit,
scale_linetype_manual(name = ystrataname, values = linetype)
}

brewer.palette <- c("BrBG", "PiYG", "PRGn", "PuOr", "RdBu", "RdGy", "RdYlBu", "RdYlGn", "Spectral", "Accent", "Dark2", "Paired", "Pastel1", "Pastel2",
"Set1", "Set2", "Set3", "Blues", "BuGn", "BuPu", "GnBu", "Greens", "Greys", "Oranges", "OrRd", "PuBu", "PuBuGn", "PuRd", "Purples",
"RdPu", "Reds", "YlGn", "YlGnBu", "YlOrBr", "YlOrRd")

brewer.palette <- c(
"BrBG", "PiYG", "PRGn", "PuOr", "RdBu", "RdGy", "RdYlBu", "RdYlGn", "Spectral", "Accent", "Dark2", "Paired", "Pastel1", "Pastel2",
"Set1", "Set2", "Set3", "Blues", "BuGn", "BuPu", "GnBu", "Greens", "Greys", "Oranges", "OrRd", "PuBu", "PuBuGn", "PuRd", "Purples",
"RdPu", "Reds", "YlGn", "YlGnBu", "YlOrBr", "YlOrRd"
)

if (!is.null(theme) && theme == "jama") {
col.pal <- c("#00AFBB", "#E7B800", "#FC4E07")
col.pal <- rep(col.pal, ceiling(length(ystratalabs)/3))
col.pal <- rep(col.pal, ceiling(length(ystratalabs) / 3))
} else if (all(linecols %in% brewer.palette)) {
col.pal <- NULL
} else {
col.pal <- linecols
col.pal <- rep(col.pal, ceiling(length(ystratalabs)/length(linecols)))
col.pal <- rep(col.pal, ceiling(length(ystratalabs) / length(linecols)))
}

if (is.null(col.pal)) {
p <- p + scale_colour_brewer(name = ystrataname, palette = linecols)
} else {
p <- p + scale_color_manual(name = ystrataname, values = col.pal)
}

# Add 95% CI to plot
if (ci == TRUE) {
if (all(linecols2 == "black")) {
Expand Down

0 comments on commit 7114224

Please sign in to comment.