Skip to content

Commit

Permalink
fix use of deprecated ggplot terms
Browse files Browse the repository at this point in the history
- size replaced with linewidth for geom_line and element_line
- replace aes_ and aes_string with aes and use .data
  • Loading branch information
grlloyd committed Feb 28, 2024
1 parent 2900f0a commit ba71ef7
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 7 deletions.
7 changes: 4 additions & 3 deletions R/glog_transformation.R
Original file line number Diff line number Diff line change
Expand Up @@ -125,11 +125,12 @@ glog_plot_optimised_lambda <- function(df, optimised_lambda, classes, qc_label,
length.out=plot_grid))
sse_df$SSE <- vapply(X=sse_df$lambda, FUN=SSE, y0=0, y=assay(df_qc),
FUN.VALUE=numeric(1))
g <- ggplot(data=sse_df, aes_string(x='lambda',y='SSE')) +
g <- ggplot(data=sse_df, aes(x=data[['lambda']],y=data[['SSE']])) +
geom_vline(xintercept=optimised_lambda, color="red") +
geom_line(size=1.1) + theme_bw() +
geom_line(linewidth=1.1) + theme_bw() +
labs (title="glog parameter optimisation",
caption=paste("optimum = ",round(optimised_lambda,2), sep=""))
caption=paste("optimum = ",round(optimised_lambda,2), sep=""))+
xlab('lambda') + ylab('SSE')
return (g)
}

Expand Down
11 changes: 7 additions & 4 deletions R/sbc_plot.R
Original file line number Diff line number Diff line change
Expand Up @@ -43,13 +43,13 @@ sbc_plot <- function(df, corrected_df, classes, batch, indexes = NULL,
manual_color <- c("#386cb0", "#ef3b2c", "#7fc97f", "#fdb462", "#984ea3",
"#a6cee3", "#778899", "#fb9a99", "#ffff33")
gg_THEME <- theme(panel.background = element_blank(),
panel.grid.major = element_line(color = "gray80", size = 0.3),
panel.grid.major = element_line(color = "gray80", linewidth = 0.3),
axis.line = element_line(color = "black"),
axis.text = element_text(color = "black"),
axis.title = element_text(color = "black"),
panel.grid.minor.x = element_line(color = "gray80",
size = 0.3, linetype = "dashed"),
panel.grid.minor.y = element_line(color = "gray80", size = 0.3))
linewidth = 0.3, linetype = "dashed"),
panel.grid.minor.y = element_line(color = "gray80", linewidth = 0.3))
plots <- list()
if (is.null(indexes) & nrow(df) >= 100) {
indexes <- seq_len(100)
Expand All @@ -64,7 +64,10 @@ sbc_plot <- function(df, corrected_df, classes, batch, indexes = NULL,
A <- melt(A, id.vars = c("x", "batch", "shapes"))

plots[[peakn]] <- ggplot(A,
aes_(~x, ~value, col = ~batch, shape = ~shapes)) +
aes(x = .data[['x']],
y = .data[['value']],
col = .data[['batch']],
shape = .data[['shapes']])) +
facet_grid(variable ~ .) + geom_point() +
scale_shape_identity() + geom_point(size=2) +
scale_colour_manual(values = manual_color) +
Expand Down

0 comments on commit ba71ef7

Please sign in to comment.