plotly.R icon indicating copy to clipboard operation
plotly.R copied to clipboard

Prevent RColorBrewer::brewer.pal warning

Open s-fleck opened this issue 4 years ago • 0 comments

RColorBrewer::brewer.pal() throws an (in this case) unnecessary warning if the output plot requires less than 2 colors. This is an easy fix, and does not change the workings of the code since RColorBrewer::brewer.pal() never returns less than three levels anywas:

> RColorBrewer::brewer.pal(2, "Set2")
[1] "#66C2A5" "#FC8D62" "#8DA0CB"
Warning message:
In RColorBrewer::brewer.pal(2, "Set2") :
  minimal value for n is 3, returning requested palette with 3 different levels

s-fleck avatar Sep 14 '21 05:09 s-fleck