Commit c7d0034f authored by dirk.wintergruen's avatar dirk.wintergruen
Browse files

more configs for createFigLayeredGraph

parent 9e15786a
__version__ = "0.9.6.6"
__version__ = "0.9.7.0"
......@@ -608,7 +608,9 @@ class MultiLayerGraph(OrderedDict):
def createFigLayeredGraph(self, name, layers, sizes,
position_per_layer=False,
layer_typ=None,
vertex_label_attr=None):
vertex_label_attr=None,
layer_labels=None,
ztickfontsize=10):
"""
:param name: name/title of the figure
......@@ -616,6 +618,8 @@ class MultiLayerGraph(OrderedDict):
:param sizes: size of the vertices
:param position_per_layer: defaults to false, show only the point which exist in the layer
:param layer_typ: dictionary layer -> types to be displayed in this layer. defaults to all type in the layer.
:param layer_labels: optional if set dictionary layer -> label to be displayed on the z-axis
:param ztickfontsize: defaults 10, size of the fonts for the network labels
:param vertex_label_attr:
:return:
"""
......@@ -697,8 +701,16 @@ class MultiLayerGraph(OrderedDict):
Xl += [x, x1, None]
Yl += [y, y1, None]
#Zl += [z, z1, None]
if layer_labels:
lz1 = layer_labels.get(z1,z1)
lz = layer_labels.get(z,z)
Zl += [lz,lz1,None]
else:
Zl += [z, z1, None]
interlayer_trace = go.Scatter3d(x=Xl,
y=Yl,
z=Zl,
......@@ -750,6 +762,11 @@ class MultiLayerGraph(OrderedDict):
Xe += [pos[es][0], pos[et][0], None] # x-coordinates of edge ends
Ye += [pos[es][1], pos[et][1], None]
# Ze += [layers.index(layer), layers.index(layer),None]
if layer_labels:
ly = layer_labels.get(layer,layer)
Ze += [ly,ly,None]
else:
Ze += [layer, layer, None]
# texts = ["%s-%s"%(e["year_s"],e["year_e"]) for e in gr.es]
......@@ -789,6 +806,9 @@ class MultiLayerGraph(OrderedDict):
Xn += [k[0] for k in pos.coords] # x-coordinates of nodes
Yn += [k[1] for k in pos.coords] # x-coordinates of nodes
# Zn += [layers.index(layer) for k in self.multi_layer.vs]
if layer_labels:
Zn += [layer_labels.get(layer,layer) for k in gr.vs]
else:
Zn += [layer for k in gr.vs]
text += gr.vs[vertex_label_attr]
color += [scale[layers.index(layer)] for x in pos.coords]
......@@ -827,7 +847,15 @@ class MultiLayerGraph(OrderedDict):
zaxis = axis.copy()
zaxis["type"] = "category"
zaxis["categoryorder"] = "array"
if layer_labels:
#zaxis["ticktext"] = [layer_labels.get(l,l) for l in layers]
zaxis["categoryarray"] = [layer_labels.get(l,l) for l in layers]
else:
zaxis["categoryarray"] = layers
zaxis["tickfont"] = {"size": ztickfontsize}
#zaxis["categoryfont"] = {"size": 500}
zaxis["showticklabels"] = True
layout = go.Layout(
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment