Plotly chart colours to match the network

This commit is contained in:
2019-04-11 13:02:29 +01:00
parent 29e0bd0cf2
commit fede4e3dc4

6
app.R
View File

@@ -560,9 +560,7 @@ server <- function(input, output, session) {
if (nrow(boxPlot) > 0) {
palette <- brewer.pal(length(legends), "RdYlGn")
#print(palette)
colours <- palette[as.integer(boxPlot$Group)]
names(palette) <- 1:length(legends)
#print(paste("Box plot, colours", nrow(boxPlot), length(colours)))
#cat(colours)
@@ -570,7 +568,7 @@ server <- function(input, output, session) {
categoryarray = boxPlot[,1],
zerolinewidth = 10)
#
plot_ly(boxPlot, x = boxPlot[,1], y = ~Range, color = colours, colors = palette, type = "box") %>%
plot_ly(boxPlot, x = boxPlot[,1], y = ~Range, color = as.character(boxPlot$Group), colors = palette, type = "box") %>%
layout(xaxis = xform, showlegend = FALSE, title = title)
}