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

How to modify node_label_fontdict? #36

Closed
fishbacp opened this issue Apr 12, 2022 · 3 comments
Closed

How to modify node_label_fontdict? #36

fishbacp opened this issue Apr 12, 2022 · 3 comments

Comments

@fishbacp
Copy link

I apologize for posting this here, as it is not a bug or issue but instead a question regarding the adjustment of node label font sizes, one that I doubt would yield a response on StackOverflow.

At https://netgraph.readthedocs.io/en/latest/graph_classes.html

it states that node_label_fontdict consists of keyword arguments passed to matplotlib.text.Text. I'm looking at matplotlib.text.Text right now and see the familiar keyword argument fontsize. It's not clear what an example dictionary, node_label_fontdict would look like if I merely wanted to change my label font size.

BTW, this package is really nice. I plan to use it for community detection in the context of EEG signal analysis.

@paulbrodersen
Copy link
Owner

paulbrodersen commented Apr 12, 2022

I apologize for posting this here, as it is not a bug or issue but instead a question regarding the adjustment of node label font sizes, one that I doubt would yield a response on StackOverflow.

That's totally fine. The fact that even after reading the documentation you are unsure what to do means that the documentation needs more work.

Basically, node_label_fontdict is dictionary with key-value pairs that are passed through to matplotlib.text.Text.

The following command sets the fontsize to 20 pts:

Graph(nx.complete_graph(7), node_labels=True, node_label_fontdict=dict(size=20))

There are a few more examples here.

@paulbrodersen
Copy link
Owner

paulbrodersen commented Apr 12, 2022

Also, thanks to your post I just learnt that fontsize is now a valid keyword for matplotlib Text objects. It used to be just size, now both are supported in matplotlib. However, looking at my code, I can see at least one set of circumstances in which a font size specification via fontsize would not be correctly handled. So apologies if you tried using that keyword instead of size and you got an error. That is a proper bug.

@fishbacp
Copy link
Author

Thanks so much. This is great!

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