Commit 99573742 authored by Tiago Peixoto's avatar Tiago Peixoto
Browse files

Fix matplotlib deprecation warning

parent 87bccc0e
......@@ -259,7 +259,7 @@ def _convert(attr, val, cmap):
vrange[1] = max(vrange[1], val[v])
else:
vrange = [val.fa.min(), val.fa.max()]
cnorm = matplotlib.colors.normalize(vmin=vrange[0],
cnorm = matplotlib.colors.Normalize(vmin=vrange[0],
vmax=vrange[1])
if val.key_type() == "v":
prop = val.get_graph().new_vertex_property("vector<double>")
......@@ -1054,7 +1054,36 @@ def get_hierarchy_control_points(g, t, tpos, beta=0.8):
Examples
--------
TODO
.. testsetup:: nested_cts
gt.seed_rng(42)
np.random.seed(42)
.. doctest:: nested_cts
>>> g = gt.collection.data["netscience"]
>>> g = gt.GraphView(g, vfilt=gt.label_largest_component(g))
>>> g.purge_vertices()
>>> bstack, mdl = gt.minimize_nested_blockmodel_dl(g, deg_corr=True)
>>> t = gt.get_hierarchy_tree(bstack)[0]
>>> tpos = pos = gt.radial_tree_layout(t, t.vertex(t.num_vertices() - 1), weighted=True)
>>> cts = gt.get_hierarchy_control_points(g, t, tpos)
>>> pos = g.own_property(tpos)
>>> b = bstack[0].vp["b"]
>>> gt.graph_draw(g, pos=pos, vertex_fill_color=b, vertex_shape=b, edge_control_points=cts,
... edge_color=[0, 0, 0, 0.3], vertex_anchor=0, output="netscience_nested_mdl.pdf")
<...>
.. testcleanup:: nested_cts
gt.graph_draw(g, pos=pos, vertex_fill_color=b, vertex_shape=b, edge_control_points=cts, edge_color=[0, 0, 0, 0.3], vertex_anchor=0, output="netscience_nested_mdl.png")
.. figure:: netscience_nested_mdl.*
:align: center
Block partition of a co-authorship network, which minimizes the description
length of the network according to the nested (degree-corrected) stochastic blockmodel.
References
......
......@@ -373,7 +373,7 @@ def graphviz_draw(g, pos=None, size=(15, 15), pin=False, layout=None,
if minmax[0] == minmax[1]:
minmax[1] += 1
if vnorm:
vnorm = matplotlib.colors.normalize(vmin=minmax[0], vmax=minmax[1])
vnorm = matplotlib.colors.Normalize(vmin=minmax[0], vmax=minmax[1])
else:
vnorm = lambda x: x
......@@ -387,7 +387,7 @@ def graphviz_draw(g, pos=None, size=(15, 15), pin=False, layout=None,
if minmax[0] == minmax[1]:
minmax[1] += 1
if enorm:
enorm = matplotlib.colors.normalize(vmin=minmax[0],
enorm = matplotlib.colors.Normalize(vmin=minmax[0],
vmax=minmax[1])
else:
enorm = lambda x: x
......
Markdown is supported
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