Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
graph-tool
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
40
Issues
40
List
Boards
Labels
Service Desk
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Incidents
Environments
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Tiago Peixoto
graph-tool
Commits
2bbbdf08
Commit
2bbbdf08
authored
Jul 20, 2015
by
Tiago Peixoto
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix problem with vertex colors in draw_hierarchy()
This closes
#238
parent
a240d1e2
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
22 additions
and
5 deletions
+22
-5
src/graph_tool/draw/cairo_draw.py
src/graph_tool/draw/cairo_draw.py
+22
-5
No files found.
src/graph_tool/draw/cairo_draw.py
View file @
2bbbdf08
...
...
@@ -1718,17 +1718,34 @@ def draw_hierarchy(state, pos=None, layout="radial", beta=0.8, ealpha=0.4,
vcolor
=
args
.
get
(
"vertex_color"
,
None
)
vertex_color
=
u
.
new_vertex_property
(
"vector<double>"
)
vertex_border_color
=
u
.
new_vertex_property
(
"vector<double>"
)
max_vc
=
None
max_bvc
=
None
for
v
in
u
.
vertices
():
if
isinstance
(
vfcolor
,
PropertyMap
):
vertex_color
[
v
]
=
vfcolor
[
v
]
elif
vcolor
is
not
None
:
vertex_color
[
v
]
=
vfcolor
if
vfcolor
.
value_type
==
"vector<double>"
:
vertex_color
[
v
]
=
vfcolor
[
v
]
elif
vfcolor
.
value_type
==
"string"
:
vertex_color
[
v
]
=
matplotlib
.
colors
.
ColorConverter
().
to_rgba
(
vfcolor
[
v
])
else
:
if
max_vc
is
None
:
max_vc
=
vfcolor
.
fa
.
max
()
vertex_color
[
v
]
=
vcmap
(
vfcolor
[
v
]
/
max_vc
)
elif
vfcolor
is
not
None
:
vertex_color
[
v
]
=
matplotlib
.
colors
.
ColorConverter
().
to_rgba
(
vfcolor
)
else
:
vertex_color
[
v
]
=
vcmap
(
b
[
v
]
/
(
B
-
1
)
if
B
>
1
else
0
)
if
isinstance
(
vcolor
,
PropertyMap
):
vertex_border_color
[
v
]
=
vcolor
[
v
]
if
vcolor
.
value_type
==
"vector<double>"
:
vertex_border_color
[
v
]
=
vcolor
[
v
]
elif
vcolor
.
value_type
==
"string"
:
vertex_border_color
[
v
]
=
matplotlib
.
colors
.
ColorConverter
().
to_rgba
(
vcolor
[
v
])
else
:
if
max_vc
is
None
:
max_vc
=
vcolor
.
fa
.
max
()
vertex_border_color
[
v
]
=
vcmap
(
vcolor
[
v
]
/
max_vc
)
elif
vcolor
is
not
None
:
vertex_border_color
[
v
]
=
vcolor
vertex_border_color
[
v
]
=
matplotlib
.
colors
.
ColorConverter
().
to_rgba
(
vcolor
)
else
:
vertex_border_color
[
v
]
=
colorConverter
.
to_rgba
(
"#babdb6"
,
1
)
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment