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

Gradient color for edges? #588

Open
earmingol opened this issue Feb 10, 2020 · 7 comments
Open

Gradient color for edges? #588

earmingol opened this issue Feb 10, 2020 · 7 comments

Comments

@earmingol
Copy link
Collaborator

I am wondering if there is a way to color the edges with a gradient that starts with the same color as the starting node and ends with the same color as the ending node.

@ericmjl
Copy link
Owner

ericmjl commented Feb 11, 2020

@earmingol at the moment, I don't think we have the necessary code implemented to do so.

That said, it'd definitely make for an interesting PR. The underlying codebase runs on the venerable matplotlib library. Doing a quick cursory interwebs search... looks like it might be tough, as every line segment in matplotlib seems to be assumed to be a single colour, and all of the hacks to do gradient colours involve slicing up the line segment into many mini line segments.

I'm not sure how else to do it though, do you think you might have a better/cleaner idea?

I'm also curious to know, for what reason would you want to have a colour gradient?

@earmingol
Copy link
Collaborator Author

@earmingol at the moment, I don't think we have the necessary code implemented to do so.

That said, it'd definitely make for an interesting PR. The underlying codebase runs on the venerable matplotlib library. Doing a quick cursory interwebs search... looks like it might be tough, as every line segment in matplotlib seems to be assumed to be a single colour, and all of the hacks to do gradient colours involve slicing up the line segment into many mini line segments.

I'm not sure how else to do it though, do you think you might have a better/cleaner idea?

@ericmjl I realized about the same, that is why I asked. I will try to implement this, but not sure if it will be easy to do and how long it could take me.

I'm also curious to know, for what reason would you want to have a colour gradient?

For my research. I am analyzing cell-cell interactions, so I will have many nodes with different molecules that mediate those interactions. I am planning to color them depending on which cells they are present in. Given that, I could have a connection between two molecules coming from different cells, so I would like to represent this with a gradient in the edge that connects them.

Also, it would be interesting implementing the ring approach as option to the circles for nodes. Something like the visualization option of this tool in https://github.com/saeyslab/nichenetr, that was made in R.

Visual

@ericmjl
Copy link
Owner

ericmjl commented Feb 11, 2020

@earmingol that's fascinating! I used Circos plots before as well, in grad school, studying source-sink gene movements between flu subtypes.

I'd love to continue the discussion on how we can implement ring-circumference (rather than dot-circumference) plots. One thing I am only semi-sure of is that ring-circumference Circos plots might need some preprocessing of a NetworkX graph object to determine ring segment widths, something I was apparently a tad too lazy to do when I was in grad school.

Let me know if you'd like to do a call. I'm based on the US East coast usually, but next week I'm going to be in the central European time zone. Happy to chat and explore ideas!

@earmingol
Copy link
Collaborator Author

@ericmjl It would be great having a call to discuss more :)

@ericmjl
Copy link
Owner

ericmjl commented Feb 13, 2020

Awesomeness! Ping me through shortwhale (I'm a bit protective of my email address): http://shortwhale.com/ericmjl, and we'll setup a time!

@earmingol
Copy link
Collaborator Author

earmingol commented Sep 11, 2020

@ericmjl sorry for the long time, but I got very busy during the last months. Anyways, I have been trying to implement this idea and I got a draft code to do something like in the figure below. I would be happy to chat more about this and looking for the best way to implement it on nxviz :). Are you available next week?

Ring-circumference

@ericmjl
Copy link
Owner

ericmjl commented Sep 11, 2020

@earmingol that looks awesome! Yeah, let's chat - and let's also take this to email, which will make scheduling a bit easier, I think. http://shortwhale.com/ericmjl

Btw, no worries on the time delay. I know in the OSS world, everything works in spurts and bursts, based on when people have time. I'm already glad that you are taking notice here!

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