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

Warning when specifying node colors #499

Closed
nwlandry opened this issue Dec 6, 2023 · 2 comments · Fixed by #512
Closed

Warning when specifying node colors #499

nwlandry opened this issue Dec 6, 2023 · 2 comments · Fixed by #512
Labels
bug Something isn't working

Comments

@nwlandry
Copy link
Collaborator

nwlandry commented Dec 6, 2023

A minimal working example is

import xgi
import random

H = xgi.Hypergraph([[1, 2], [2, 3, 4]])

c1 = "maroon"
c2 = "white"
node_fc = [c1 if random.random() < 0.5 else c2 for i in H.nodes]
xgi.draw(H, node_fc=node_fc)

produces this warning

UserWarning: No data for colormapping provided via 'c'. Parameters 'cmap' will be ignored
  node_collection = ax.scatter(
@nwlandry nwlandry added the bug Something isn't working label Dec 6, 2023
@maximelucas
Copy link
Collaborator

maximelucas commented Dec 7, 2023

Yes, this is kind of matplotlib behavior I think. The default cmap is not None but you're specificying colors with colors and not with values so it's just saying there's no values to map to colors so cmap is ignored.
We could fix this either by making sure cmap is None in case colors are specified, or by just hiding the user warning. In any case, the outputs are not wrong.

@Liyubov
Copy link

Liyubov commented Jan 10, 2024

it is not directly related to the node color, but more node size and node labels, in the current https://xgi.readthedocs.io/en/stable/api/drawing/xgi.drawing.draw.html#module-xgi.drawing.draw it seems not clear to me if you also allow to specify the changed size of the text of node lables.
and if yes, to document it on the drawing function maybe?
thanks!

Edit by @maximelucas : created a new issue #500 with this because it's different enough

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants