talgalili / dendextend

Extending R's Dendrogram Functionality
152 stars 28 forks source link

added support for "bg" attribute for nodes and leaves #109

Closed pschupp closed 2 years ago

talgalili commented 2 years ago

Hey, Thanks for the PR. Could you please make sure you update the documents, and also show an example of how the new code works? (it's not clear to me if just adding these arguments would make this now work out of the box - did you check it?!)

pschupp commented 2 years ago

Thank you for the package! I updated "Quick_Introduction.Rmd" with the new options. I tested it myself already and it works without issue. I wasn't sure whether I should add/change one of the example plots under heading "Setting a dendrogram’s nodes/leaves (points)" in "Quick_Introduction.Rmd", as the change is minor. If you think it is appropriate to change an existing plot to show the new functionality, let me know!

I am attaching a plot created by the change here. dendrogram.pdf

talgalili commented 2 years ago

FYI - the pch supported is 21-25 (not 19-21), I will fix the text in followup diff, and will add this example:

library("dendextend")

set.seed(23235)
ss <- sample(1:150, 25)

# Getting the dend object
dend <- iris[ss, -5] %>%
   dist() %>%
   hclust() %>%
   as.dendrogram()

dend %>%
   set("labels", 1:25) %>%
   set("nodes_pch", 21) %>% # set all nodes to be pch 21
   set("nodes_col", "darkred") %>%
   set("nodes_bg", "gold") %>%
   set("leaves_pch", 1:25) %>% # Change the leaves pch to move from 1 to 25
   set("leaves_col", "darkred") %>%
   set("leaves_bg", "gold") %>%
   plot(main = "pch 21 to 25 supports the\nnodes_bg and leaves_bg parameters")

image

talgalili commented 2 years ago

@pschupp - FYI - I've updated dendextend in github to 1.16.0 with your PR. And also added your name to the NEWS file and as a contributor to the DESCRIPTION file. If you have more PR - you are more than welcome to send the my way :)

pschupp commented 2 years ago

Thank you very much. And sorry about misremembering the "pch" numbers, you are right of course!

talgalili commented 1 year ago

My pleasure. No worries. Feel free to send more PR :)

T

On Mon, 4 Jul 2022, 23:51 pschupp, @.***> wrote:

Thank you very much. And sorry about misremembering the "pch" numbers, you are right of course!

— Reply to this email directly, view it on GitHub https://github.com/talgalili/dendextend/pull/109#issuecomment-1174331201, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAHOJBWWHKRZMYLRMBXJOFTVSNFEJANCNFSM52KD74VA . You are receiving this because you modified the open/close state.Message ID: @.***>

talgalili commented 1 year ago

Could you please add a screenshot here with a code snippet to just let me understand what this will look like?

Thanks!

On Thu, Jun 30, 2022 at 10:31 PM pschupp @.***> wrote:

Thank you for the package! I updated "Quick_Introduction.Rmd" with the new options. I tested it myself already and it works well. I wasn't sure whether I should add/change one of the example plots under heading "Setting a dendrogram’s nodes/leaves (points)" in "Quick_Introduction.Rmd", as the change is minor. If you think it is appropriate to change an existing plot to show the new functionality, let me know!

— Reply to this email directly, view it on GitHub https://github.com/talgalili/dendextend/pull/109#issuecomment-1171598489, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAHOJBVE33WOXJKL4VHVOXDVRXY2VANCNFSM52KD74VA . You are receiving this because you commented.Message ID: @.***>

pschupp commented 1 year ago

Hi, Was this posted in error? It seems that your comment (4th on the thread) provides an excellent example of the behavior. Let me know if this is untrue, though I don't think I can improve on your work.