Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Default color palette has a typo #42

Open
brianwdavis opened this issue Apr 1, 2022 · 0 comments · May be fixed by #48
Open

Default color palette has a typo #42

brianwdavis opened this issue Apr 1, 2022 · 0 comments · May be fixed by #48

Comments

@brianwdavis
Copy link

brianwdavis commented Apr 1, 2022

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)

@brianwdavis brianwdavis linked a pull request Sep 1, 2022 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant