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

Remove white contour in legend #1

Closed
abichat opened this issue Jul 3, 2019 · 2 comments
Closed

Remove white contour in legend #1

abichat opened this issue Jul 3, 2019 · 2 comments
Assignees
Labels
bug Something isn't working

Comments

@abichat
Copy link

abichat commented Jul 3, 2019

When using ggchicklet legend on a non-white backgroud, one can see the white contour around the legend, as below.

Would it be possible to remove the contour? Or better: to choose the contour color? (Maybe with the new key_glyph argument?)

plot_2019-07-02

Thanks

@hrbrmstr hrbrmstr self-assigned this Jul 3, 2019
@hrbrmstr hrbrmstr added the bug Something isn't working label Jul 3, 2019
@hrbrmstr
Copy link
Owner

hrbrmstr commented Jul 4, 2019

library(ggchicklet)
library(hrbrthemes)
library(ggplot2)

data("debates2019")

spkr_ordr <- aggregate(elapsed ~ speaker, data = debates2019, sum)
spkr_ordr <- spkr_ordr[order(spkr_ordr[["elapsed"]]),]

debates2019$speaker <- factor(debates2019$speaker, spkr_ordr$speaker)

ggplot(debates2019) +
  geom_chicklet(
    aes(speaker, elapsed, group = timestamp, fill = topic),
    colour = "#252a32"
  ) +
  scale_y_continuous(expand = c(0, 0.01), position = "right") +
  ggthemes::scale_fill_tableau("Tableau 20") +
  coord_flip() +
  labs(x = NULL, y = "Minutes Spoken", fill = NULL) +
  theme_ft_rc() +
  theme(panel.grid.major.y = element_blank()) +
  theme(legend.position = "bottom")

image

@corriebar
Copy link

Hey, I'm facing the same issue. I tried to recreate your plot but I only see it with the boundaries:

library(ggchicklet)
library(hrbrthemes)
library(ggplot2)

data("debates2019")

spkr_ordr <- aggregate(elapsed ~ speaker, data = debates2019, sum)
spkr_ordr <- spkr_ordr[order(spkr_ordr[["elapsed"]]),]

debates2019$speaker <- factor(debates2019$speaker, spkr_ordr$speaker)
debates2019$topic <- forcats::fct_lump(debates2019$topic, n=19)

db <- debates2019 %>% filter(debate_date <= as_date("2019-07-04")) # empty

ggplot(debates2019) +
  geom_chicklet(
    aes(speaker, elapsed, group = timestamp, fill = topic),
    colour = "#252a32"
  ) +
  scale_y_continuous(expand = c(0, 0.01), position = "right") +
  ggthemes::scale_fill_tableau("Tableau 20") +
  coord_flip() +
  labs(x = NULL, y = "Minutes Spoken", fill = NULL) +
  theme_ft_rc() +
  theme(panel.grid.major.y = element_blank()) +
  theme(legend.position = "bottom")

image

(On a side note: I was surprised to see that the debates data set apparently doesn't contain any debates from before September 2019 anymore)

> sessionInfo()
R version 4.0.2 (2020-06-22)
Platform: x86_64-pc-linux-gnu (64-bit)
Running under: Ubuntu 20.04.1 LTS

Matrix products: default
BLAS:   /usr/lib/x86_64-linux-gnu/blas/libblas.so.3.9.0
LAPACK: /usr/lib/x86_64-linux-gnu/lapack/liblapack.so.3.9.0

locale:
 [1] LC_CTYPE=en_US.UTF-8       LC_NUMERIC=C               LC_TIME=de_DE.UTF-8        LC_COLLATE=en_US.UTF-8     LC_MONETARY=de_DE.UTF-8    LC_MESSAGES=en_US.UTF-8   
 [7] LC_PAPER=de_DE.UTF-8       LC_NAME=C                  LC_ADDRESS=C               LC_TELEPHONE=C             LC_MEASUREMENT=de_DE.UTF-8 LC_IDENTIFICATION=C       

attached base packages:
[1] stats     graphics  grDevices utils     datasets  methods   base     

other attached packages:
[1] ggplot2_3.3.2    hrbrthemes_0.8.0 ggchicklet_0.5.2

loaded via a namespace (and not attached):
 [1] Rcpp_1.0.5        pillar_1.4.6      compiler_4.0.2    forcats_0.5.0     tools_4.0.2       extrafont_0.17    digest_0.6.25     packrat_0.5.0     evaluate_0.14     lifecycle_0.2.0  
[11] tibble_3.0.3      gtable_0.3.0      pkgconfig_2.0.3   rlang_0.4.7       cli_2.0.2         rstudioapi_0.11   xfun_0.16         Rttf2pt1_1.3.8    stringr_1.4.0     withr_2.2.0      
[21] dplyr_1.0.1       knitr_1.29        generics_0.0.2    gdtools_0.2.2     vctrs_0.3.2       systemfonts_0.2.3 grid_4.0.2        tidyselect_1.1.0  glue_1.4.1        R6_2.4.1         
[31] fansi_0.4.1       rmarkdown_2.2     farver_2.0.3      purrr_0.3.4       extrafontdb_1.0   magrittr_1.5      scales_1.1.1      ellipsis_0.3.1    htmltools_0.5.0   ggthemes_4.2.0   
[41] assertthat_0.2.1  colorspace_1.4-1  labeling_0.3      tinytex_0.25      stringi_1.4.6     munsell_0.5.0     crayon_1.3.4    

Any ideas what could be the issue here?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants