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

feature request: use "free text" symbol in layer_symbol(), and add color, size options #108

Open
frankyan opened this issue Jan 10, 2023 · 3 comments · Fixed by #111
Open
Labels
enhancement New feature or request

Comments

@frankyan
Copy link

Thank you for creating this fantastic package.

I want to display some values in the heatmap cells. Although he cell_fun or layer_fun argument from ComplexHeatmap can be added to tidyHeatmap::heatmap function to customize the display, I think it's much better and user-friendly to implement it in tidyHeatmap functions, similar to the layer_symbol() function.

The idea is to add freetext, color, and size to the layer_symbol() function. Then the layer_symbol() function is much more customizable. I have modified the code and created a pull request.
#107 (comment)

Here are some examples.

mtcars_tidy %>% 
  mutate(label = sprintf("%.1f", Value),
         color_label = ifelse(Value > 0, "darkred", "white")) %>% 
  heatmap(`Car name`, Property, Value, 
          palette_value = colorRamp2(c(-3, 0, 3), c("blue", "white", "red")))  %>% 
  layer_symbol(Value > 1 | Value < -1,
               symbol = "freetext", 
               freetext = label, 
               color = color_label, 
               size = 10)

image

mtcars_tidy %>% 
  heatmap(`Car name`, Property, Value, 
          palette_value = colorRamp2(c(-3, 0, 3), c("blue", "white", "red")))  %>% 
  layer_symbol(Value > 1,
               symbol = "freetext", 
               freetext = "+", 
               size = 10) %>%
  layer_symbol(Value < -1,
               symbol = "freetext", 
               freetext = "-", 
               size = 15) 

image

mtcars_tidy %>% 
  heatmap(`Car name`, Property, Value, 
          palette_value = colorRamp2(c(-3, 0, 3), c("blue", "white", "red")))  %>% 
  layer_point(Value < -1, color = "yellow")

image

@stemangiola stemangiola added the enhancement New feature or request label Jan 10, 2023
@stemangiola
Copy link
Owner

Thanks a lot!

I left a review of your pull request.

@frankyan
Copy link
Author

Thank you. I will follow your suggestions to make changes and update it later.

@stemangiola stemangiola linked a pull request Mar 23, 2023 that will close this issue
@stemangiola
Copy link
Owner

I have added the text support, although with no color

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants