teneto icon indicating copy to clipboard operation
teneto copied to clipboard

Control colormap of temporal graph nodes

Open vanbanTruong opened this issue 4 years ago • 4 comments

Is your feature request related to a problem? Please describe. Would it be possible to control the color of the temporal graph nodes when using tnet.plot()? For example give an array [0, 10] then the nodes color will change from light to dark from left to light. Thanks.

Describe the solution you'd like A clear and concise description of what you want to happen.

Describe alternatives you've considered A clear and concise description of any alternative solutions or features you've considered.

Additional context Add any other context or screenshots about the feature request here.

vanbanTruong avatar Jun 09 '20 16:06 vanbanTruong

Other than the option of providing an array, current nodes' cmap transmits vertically within each time series, would it be possible to across the time dimension, i.e., horizontally, instead?

vanbanTruong avatar Jun 09 '20 17:06 vanbanTruong

As you note, the cmap value only is for vertical values.

The plotting code is due for updating (it was some of the first python code I ever wrote) and I will make sure this is added at the update.

A workaround to solve the problem at the moment: the matplotlib ax object is returned from the plotting function which you can still modify. Here is an example:

import teneto
import matplotlib.pyplot as plt
# Create network object
tnet = teneto.TemporalNetwork()  
# Generate some random data
tnet.generatenetwork('rand_binomial', prob=0.5, size=(3,4)) 
# Plot and return matplotlib axis
ax = tnet.plot('slice_plot') 
# For the 1st time point (x=0) replot all nodes as red 
ax.scatter([0,0,0], [0,1,2], s=100, color='red', zorder=100)  
plt.show()

Creates the following image for me:

slice_plot_fix

Let me know if something was unclear.

wiheto avatar Jun 09 '20 20:06 wiheto

Thanks for the prompt reply. Let me know when such additional feature has been added :)

vanbanTruong avatar Jun 11 '20 02:06 vanbanTruong

Will do. Does the workaround work for you, for the time being? On Wed, 2020-06-10 at 19:17 -0700, WenbinZ wrote:

[email protected]>

wiheto avatar Jun 11 '20 05:06 wiheto