schlegelp / tanglegram

Plot tanglegrams from two dendrograms
GNU General Public License v3.0
19 stars 4 forks source link

Coloring the Connecting branches #3

Open chaunceychason opened 6 years ago

chaunceychason commented 6 years ago

Would it be possible to implement the color functionality contained in the original R code so that the middle panel isnt just grey? I have tons of items in my dendrogram, so currently the connecting bars are all running together as a single grey bar. Being able to change the color on those objects would be super helpful

schlegelp commented 6 years ago

Could you clarify please? I see three options to colourise off the top of my head:

  1. Give connecting lines have the same colour as the leafs in the dendrogram. What if the left and the right leaf have different colours?
  2. Assign custom colours to each connecting line (i.e. per label)?
  3. Map entanglement to RGB value instead of shades of grey.
chaunceychason commented 6 years ago

Thanks for the reply. I noticed the function doesnt return a plot object to modify. I could easily manually assign the colors if the API allows it. Is there a fig or plt instance for each subplot?

On Thu, Jul 19, 2018 at 2:21 AM, Philipp Schlegel notifications@github.com wrote:

Could you clarify please? I see three options to colourise off the top of my head:

  1. Give connecting lines have the same colour as the leafs in the dendrogram. What if the left and the right leaf have different colours?
  2. Assign custom colours to each connecting line?
  3. Map entanglement to RGB value instead of shades of grey.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/schlegelp/tanglegram/issues/3#issuecomment-406179983, or mute the thread https://github.com/notifications/unsubscribe-auth/AM8pAhK8_PFC-aZb0hMonWIGco3YHhX1ks5uIDNmgaJpZM4VVlkF .

schlegelp commented 6 years ago

Yes you're right. The function returns a matplotlib figure. It has three axes which you can get with fig.get_axes(). The first two are the left and right dendrogram respectively, the last one is the centre lines. Have a go at it and let me know if you figure out a way to colourise them that makes sense to you.

I'll try to implement a way to do this natively.