Skip to content

Commit 870c0ca

Browse files
committed
color palette for degree distribution
1 parent 41f6d9b commit 870c0ca

1 file changed

Lines changed: 7 additions & 2 deletions

File tree

server.R

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1377,8 +1377,13 @@ output$degreedist <- renderPlot({
13771377
if(!is.null(input$colorby_dd)){
13781378
if(input$colorby_dd != "None"){
13791379
ncolors <- dim(dd_plotdata())[1]
1380-
color <- brewer.pal(ncolors,"Blues")[1:ncolors]
1381-
color[is.na(color)] <- brewer.pal(9, "Blues")
1380+
if(ncolors == 2){
1381+
color <- c("#eff3ff", "#377FBC")
1382+
} else if(ncolors < 10){
1383+
color <- brewer.pal(ncolors,"Blues")
1384+
} else if(ncolors >= 10){
1385+
color <- colorRampPalette(brewer.pal(9,"Blues"))(ncolors)
1386+
}
13821387
ltext <- sort(unique(get.vertex.attribute(nw(),input$colorby_dd)))
13831388
ltext <- append(ltext, "")
13841389
lfill <- c(color, 0)

0 commit comments

Comments
 (0)