Skip to content

Default color palette has a typo #42

@brianwdavis

Description

@brianwdavis

I generated a reprex below, but essentially the # is missing from one of the hex colors in the palette d3.schemeCategory10. This means that it shows up as blank in legends but black in the charts. This bug only appears when there are >6 categories shown, which is rare I'm sure. Using version 0.6.2 from CRAN today.

library(dplyr)
#> 
#> Attaching package: 'dplyr'
#> The following objects are masked from 'package:stats':
#> 
#>     filter, lag
#> The following objects are masked from 'package:base':
#> 
#>     intersect, setdiff, setequal, union
library(leaflet)
library(leaflet.minicharts)

# Notice the missing "#..." on color 7?
print(d3.schemeCategory10)
#>  [1] "#1f77b4" "#ff7f0e" "#2ca02c" "#d62728" "#9467bd" "#8c564b" "e377c2" 
#>  [8] "#7f7f7f" "#bcbd22" "#17becf"

# This throws an error because of it
scales::show_col(d3.schemeCategory10)
#> Error in rect(col(colours) - 1, -row(colours) + 1, col(colours), -row(colours), : invalid color name 'e377c2'

# Here's a sample dataset to demonstrate
x <- tibble(
  latitude = 38:40, 
  longitude = -77:-79
) %>% 
  mutate(
    a = runif(3),
    b = runif(3),
    c = runif(3),
    d = runif(3),
    e = runif(3),
    f = runif(3),
    g = runif(3)
  )

leaflet() %>% 
  addTiles() %>% 
  addMinicharts(
    x$longitude, x$latitude,
    type = "pie", 
    chartdata = x %>% select(a:g)
  )

Created on 2022-03-31 by the reprex package (v2.0.1)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions