pymnet icon indicating copy to clipboard operation
pymnet copied to clipboard

Seeking help, encountered an error with fig = draw(),how to deal with it?

Open Morri2676 opened this issue 1 year ago • 1 comments

AttributeError Traceback (most recent call last) in () 23 two_layer_net[4, 4, 'a', 'b'] = 1 24 ---> 25 fig = draw(two_layer_net, layout="circular") ....... AttributeError: 'NoneType' object has no attribute 'text'

Morri2676 avatar Nov 11 '23 03:11 Morri2676

Hi, Why Are you using it like that? Considering how to import the library, you should do one of these:

import pymnet
# Create an instance of it :
two_layer_net = pymnet.MultilayerNetwork()
# For it to be a neet work : 
two_layer_net.add_layer('a')
two_layer_net.add_layer('b')
two_layer_net.add_node(4,'a')
two_layer_net.add_node(4, 'b')
# And then :
two_layer_net[4, 4, 'a', 'b'] = 1
pymnet.draw(two_layer_net , layout="circle", show = True )

OR

from pymnet import *
# Create an instance of it :
two_layer_net = MultilayerNetwork()
# For it to be a neet work : 
two_layer_net.add_layer('a')
two_layer_net.add_layer('b')
two_layer_net.add_node(4,'a')
two_layer_net.add_node(4, 'b')
# And then :
two_layer_net[4, 4, 'a', 'b'] = 1
draw(two_layer_net , layout="circle", show = True)

Be Aware: The option for layout is"circle" , Not 'circlar' !!!

cloner174 avatar Apr 22 '24 10:04 cloner174

Hi, it is not clear where the error is occurring. The error message shows that you're trying to call a method of a None object, which I couldn't replicate with the draw function. If you want to draw the network into a specific axes object, you can use the ax parameter of draw.

ercco avatar Jun 17 '24 09:06 ercco