Skip to content

Commit

Permalink
minor changes to color palette, avoiding red-green comparisons
Browse files Browse the repository at this point in the history
  • Loading branch information
ltronneb committed Sep 16, 2020
1 parent da8b7d6 commit 128d168
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
1 change: 1 addition & 0 deletions NAMESPACE
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ importFrom(ggplot2,ylim)
importFrom(ggridges,geom_density_ridges_gradient)
importFrom(ggridges,theme_ridges)
importFrom(gridExtra,grid.arrange)
importFrom(inlmisc,GetColors)
importFrom(plotly,"%>%")
importFrom(plotly,add_surface)
importFrom(plotly,add_trace)
Expand Down
6 changes: 3 additions & 3 deletions R/plot.bayesynergy.R
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
#' @importFrom plotly plot_ly add_surface add_trace %>% plotly_build
#' @importFrom scales math_format
#' @importFrom gridExtra grid.arrange
#' @importFrom inlmisc GetColors
#'
#' @export

Expand Down Expand Up @@ -127,7 +128,7 @@ plot.bayesynergy <- function(x, plot3D = T, save_plot = FALSE, path = NULL, plot
z_Delta = x$posterior_mean$Delta[-1,-1]
fig = plot_ly()
fig = fig %>% add_trace(x = unqX1, y = unqX2, z = z_Delta,type = "surface",
colorscale = list(c(0,0.5, 1), c("green","yellow", "red")),cmin=-1,cmax=1)
colorscale = list(c(0,0.5, 1), c("2166AC","EAECCC", "B2182B")),cmin=-1,cmax=1)
fig = fig %>% plotly::layout(scene = list(zaxis= list(range=c(-1,1),
title="Interaction"),
xaxis = list(title=x$data$drug_names[1]),
Expand Down Expand Up @@ -234,7 +235,7 @@ plot.bayesynergy <- function(x, plot3D = T, save_plot = FALSE, path = NULL, plot


#Interaction surface has a different color scale
Delta_col_palette <- colorRampPalette(c("green", "yellow", "red"))
Delta_col_palette <- inlmisc::GetColors(scheme = "sunset")
# Breaks
eps = 0.05
breaks = c(seq(-1,-0.1,by=0.1),0-eps,0+eps,seq(0.1,1,by=0.1))
Expand All @@ -259,7 +260,6 @@ plot.bayesynergy <- function(x, plot3D = T, save_plot = FALSE, path = NULL, plot
subtitle = paste0(x$data$experiment_ID,": ",x$data$drug_names[1]," + ", x$data$drug_names[2])) +
guides(fill=guide_legend(ncol=1))


####################################################################################
# Summary statistics
####################################################################################
Expand Down

0 comments on commit 128d168

Please sign in to comment.