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

Specify edge_color and node_color? #572

Open
whash1234 opened this issue Sep 16, 2019 · 6 comments
Open

Specify edge_color and node_color? #572

whash1234 opened this issue Sep 16, 2019 · 6 comments

Comments

@whash1234
Copy link

whash1234 commented Sep 16, 2019

  • nxviz version: 0.6.1
  • Python version: 3.7.3
  • Operating System: Windows 10

Description

I was wondering if there was any way to manually select the different colors when creating a plot and adding edge_color or node_color to a key/value pair.

In my case, I have 2 different types of edges named 'destination' and have set edge_color = 'destination' which works to color the two types differently, but would prefer a different set of colors than the default colors (in this case greenish/pinkish)

Do you know how to manually define the different colors (maybe even for specific values)?

@ericmjl
Copy link
Owner

ericmjl commented Sep 21, 2019

@whash1234 thanks for pinging in 😄

I can't remember the API clearly at this moment (on mobile and on the move), but I think edge colors can be controlled by one of the keyword arguments that are passed into the CircosPlot constructor. The docs page might have a clue there.

@whash1234
Copy link
Author

Hi I was wondering if you had an update? I still am unable to change the default colors for nodes and edges. Again, I have mapped the nodes to metadata (in this case, 'sentiment') and I wanted to be able to set the colors they get. So, for 'positive' sentiment I would like to set it to green, 'negative' to red, etc. But I cannot find a way to change the default colors it naturally sets these to! They get set as a default to light green / gray and I am unable to change.

@ericmjl
Copy link
Owner

ericmjl commented Jan 11, 2020

@whash1234 thanks pinging in again. Now that I’ve read your comment again, I see what you’re trying to do here. Setting a specific color mapping isn’t implemented, as the design of the library didn’t include that in an earlier iteration.

The source code is modifiable, though, and if you look inside the BasePlot constructor from which all other plots inherit, you will see that the setting of node_color happens there. I unfortunately have been swamped with work commitments the past quarter, and looking at what I have on hand going forward, I don’t think I will have time to implement new feature requests that are also properly documented and tested (which is the requirement I have imposed on the library to maintain code quality) in the near-term.

If, however, you’d like to give it a shot at implementing this, I’m open to accepting a pull request, and talking through the codebase if you’d like to attempt implementing this feature - it would be a great win-win for your GitHub profile and for the library. Also it’d be a great contribution back to the community! I’m also trying to encourage more people to make code commons-type of contributions, and happy to guide you through open source dev if you’re not already comfortable with it.

@Rabeez
Copy link
Collaborator

Rabeez commented Jan 16, 2020

@whash1234 I've pushed a branch node_cmap which adds the option to pass a colormap to the plot functions. I'm also busy with work commitments so can't fully test the implementation to add it to master. You can clone the repo and build the relevant branch (look in CONTRIBUTONG.rst for instructions) to get the functionality; let me know if you need help with this.

@whash1234
Copy link
Author

@Rabeez Sorry I have also been caught up at work. How would I go about cloning the repository and building the branch out? I have had little experience in this space in the past couple years. Any help would be appreciated, but this is also not the most urgent issue!

@ericmjl
Copy link
Owner

ericmjl commented Jan 21, 2020

@whash1234 thanks for getting back! Let me see, I think I might be able to help with this.

Firstly, create a fork of the nxviz repository to go under your username. It'll be now whash1234/nxviz.

Secondly, create a branch called node_cmap.

Thirdly, create a pull request from ericmjl: nxviz/node_cmap into whash: nxviz/node_cmap, and merge in the changes.

@Rabeez, I think that's the right way to approach this, but if you have a better way to do this, please let me know. @whash1234 I would advise waiting until @Rabeez replies before we go on, but also not to wait too long - if it's the weekend and he hasn't gotten back yet, let's assume that this is the right way to go for now.

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

3 participants