setting title and color bar, directed graph
See original GitHub issueHi @marcomusy
This is a follow up to my question on SO. I’d like to ask for clarification on the following,
-
I’d like to know how to assign symbols in
title
of a scalarbar. Latex formatting doesn’t work e.g.nx_pts.pointColors(vals, cmap='YlGn', vmin=min(vals), vmax=max(vals)).addScalarBar(title='$\mu$')
-
How can we set titles for plot? I tried,
show(nx_pts, nx_edg, nx_pts.labels('id'), interactive=True, bg='black', title='plot')
this doesn’t display the title. -
Is it possible to create discontinuous color bars? For example, while trying to assign the following set of values that contains an outlier
vals = [100, .80, .10, .79, .70, .60, .75, .78, .65, .90]
all entries, except 100, are assigned the same color.
Please find the complete code below,
import networkx as nx
from vedo import *
G = nx.gnm_random_graph(n=10, m=15, seed=1)
nxpos = nx.spring_layout(G)
nxpts = [nxpos[pt] for pt in sorted(nxpos)]
nx_lines = []
for i, j in G.edges():
p1 = nxpos[i].tolist() + [0] # add z-coord
p2 = nxpos[j].tolist() + [0]
nx_lines.append([p1, p2])
nx_pts = Points(nxpts, r=12)
nx_edg = Lines(nx_lines).lw(2)
# node values
vals = [100, .80, .10, .79, .70, .60, .75, .78, .65, .90]
nx_pts.pointColors(vals, cmap='YlGn', vmin=min(vals), vmax=max(vals)).addScalarBar(title='$\mu$')
show(nx_pts, nx_edg, nx_pts.labels('id'), interactive=True, bg='black', title='plot')
- How to convert the above graph,
G
, to a directed graph? From the suggestion offered on SO, I could use g = DirectedGraph(layout=‘fast2d’)
I am not sure how to add edges
ed_ls = [(0, 6), (0, 7), (0, 5), (8, 0), (0, 4), (1, 4), (1, 7), (1, 9), (2, 9), (3, 6), (3, 4), (8, 3), (3, 5), (3, 7), (6, 9)]
for each item in ed_ls
, e.g. (0,6) the edge is directed from 0 to 6.
Thanks a lot
Issue Analytics
- State:
- Created 3 years ago
- Comments:38 (16 by maintainers)
Top GitHub Comments
Works on windows!
@marcomusy The update works! And the interpolation looks great!