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

setting label size different to text size? #38

Open
Pakillo opened this issue Apr 18, 2024 · 2 comments
Open

setting label size different to text size? #38

Pakillo opened this issue Apr 18, 2024 · 2 comments

Comments

@Pakillo
Copy link

Pakillo commented Apr 18, 2024

Hi @nrennie

I need to set different sizes for text in nodes and labels, respectively. As far as I can see, it could be as easy as adding a new parameter label_size here (currently label size is fixed the same as text_size).

Please let me know if you would like a pull request with that minor change, or if there are better ways to achieve that. I've been looking for a way to change label size afterwards, but it doesn't look straightforward (https://stackoverflow.com/questions/42006040/how-to-change-font-size-of-geom-text-post-ex)

Thanks!

@Pakillo
Copy link
Author

Pakillo commented Apr 19, 2024

Actually it's not that hard to change label size afterwards (reprex below), so maybe there's no need for a label_size argument. But let me know if you'd like a pull request anyway

Cheers!

library(ggflowchart)

data <- tibble::tibble(
  from = c("A", "A", "A", "B", "C", "F"),
  to = c("B", "C", "D", "E", "F", "G"),
  label = c("Yes", "No", NA, "Yes", NA, NA)
)

gg <- ggflowchart(data)
gg$layers[[4]]$aes_params$size <- 8
gg

Created on 2024-04-19 with reprex v2.1.0

@Pakillo Pakillo closed this as completed Apr 19, 2024
@nrennie
Copy link
Owner

nrennie commented Apr 19, 2024

Hi @Pakillo, this sounds like a reasonable adjustment. If you want to submit a PR, that would be great! Otherwise, you can leave the issue open and I can add the argument in soon(ish).

I would suggest calling the argument arrow_label_size or arrow_text_size to distinguish it from text_size more clearly and to match with arrow_label_fill, and set the default value equal to text_size to ensure backwards compatibility.

@nrennie nrennie reopened this Apr 19, 2024
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