mne-tools / mne-connectivity

Connectivity algorithms that leverage the MNE-Python API.
https://mne.tools/mne-connectivity/dev/index.html
BSD 3-Clause "New" or "Revised" License
65 stars 34 forks source link

Different text color for node names in plot_connectivity_circle() function #169

Open mahirtazwar opened 5 months ago

mahirtazwar commented 5 months ago

Is it possible to add different text colors to each node name when plotting with mne_connectivity.viz.plot_connectivity_circle() function, similar to the node_colors parameter. For example, I would like to represent the node names that has significant connections with textcolor='black', and textcolor='gray' for those without any significant connections. Currently, only a single textcolor is supported.

I have also tried using the matplotlib.axes.Axes.tick_params() function to change the tick colors, but it does not work (despite not showing any errors).


fig, axes = plt.subplots(figsize=(10,10), facecolor='w', subplot_kw=dict(polar=True))

gFig, gAx = plot_connectivity_circle(conmat,
                             list(df),
                             node_colors=dmap.nodecolor,
                             node_angles=node_angles,
                             facecolor='w',
                             textcolor='k',
                             fontsize_names=10,
                             colormap='hot',
                             node_edgecolor='w',
                             ax=axes, show=False)

# Both the following option do not work
axes.tick_params(axis='both', labelcolor='red')
gAx.tick_params(axis='both', labelcolor='red')

I have currently resorted to using image editing software (e.g., Inkscape) to do this trick, but let me know if it is possible to represent the node name texts in different color with python code.

adam2392 commented 3 months ago

Sure, a PR with a unit-test is welcome!