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

Color issue when used together with dark theme #25

Open
AndhikaWB opened this issue Jul 22, 2024 · 5 comments
Open

Color issue when used together with dark theme #25

AndhikaWB opened this issue Jul 22, 2024 · 5 comments

Comments

@AndhikaWB
Copy link

AndhikaWB commented Jul 22, 2024

Text doesn't show when this library is used together with ggdark theme

library(ggdark)

data("love_words_small")
ggplot(love_words_small, aes(label = word, size = speakers)) +
  geom_text_wordcloud() +
  scale_size_area(max_size = 30) +
  dark_theme_minimal()

When not used with ggdark (ignore the overlapping text, too lazy to fix)
image


When used with ggdark (see code above)
image


Changing color to white via the color parameter also doesn't seem to produce white text, it will produce red/orange text instead

data("love_words_small")
ggplot(love_words_small, aes(label = word, size = speakers, color = 'white')) +
  geom_text_wordcloud() +
  scale_size_area(max_size = 40) +
  dark_theme_minimal()

image

@AndhikaWB
Copy link
Author

Tested on both cairo (png) and svglite (svg) renderer

Here is my example Quarto markdown (.qmd) header:

---
title: Test
author: AndhikaWB
date: last-modified
date-format: long
format: gfm
knitr:
  opts_chunk:
    echo: true
    results: hold
    dev: svglite
    dev.args:
      scaling: 1.25
---

@lepennec
Copy link
Owner

Let me look at this issue.

@AndhikaWB
Copy link
Author

Oh wait, the scale_color_gradient works just fine, I just forgot to add the color argument on the ggplot function (gonna edit the original post soon)

The red/orange text issue when using color = 'white', however, is still reproducible

@lepennec
Copy link
Owner

For the color = 'white' issue, you should put color outside aes.

That said, it seems that there is a strange issue with the current library stack, as I cannot reproduce my own examples...

@AndhikaWB
Copy link
Author

Hi @lepennec

I tried putting color = 'white' outside aes but the font color is now all black/blank (since the background is black too)

data("love_words_small")
ggplot(love_words_small, aes(label = word, size = speakers), color = 'white') +
  geom_text_wordcloud() +
  scale_size_area(max_size = 40) +
  dark_theme_minimal()

For now I'm using scale_color_gradient or other scale function as workaround

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

No branches or pull requests

2 participants