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
43
Issues
43
List
Boards
Labels
Service Desk
Milestones
Merge Requests
1
Merge Requests
1
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
6ba338ef
Commit
6ba338ef
authored
Nov 07, 2008
by
Tiago Peixoto
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Graph drawing: fix edge properties and other things
parent
869ac654
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
16 additions
and
11 deletions
+16
-11
src/graph_tool/draw/__init__.py
src/graph_tool/draw/__init__.py
+16
-11
No files found.
src/graph_tool/draw/__init__.py
View file @
6ba338ef
...
...
@@ -28,7 +28,8 @@ def graph_draw(g, pos=None, size=(15,15), pin=False, layout="neato",
mode
=
"ipsep"
,
penwidth
=
1.0
,
eweight
=
None
,
ewidth
=
None
,
gprops
=
{},
vprops
=
{},
eprops
=
{},
vcolor
=
None
,
ecolor
=
None
,
vcmap
=
matplotlib
.
cm
.
jet
,
vnorm
=
True
,
ecmap
=
matplotlib
.
cm
.
jet
,
enorm
=
True
,
output
=
None
,
output_format
=
None
,
seed
=
0
):
enorm
=
True
,
output
=
""
,
output_format
=
"auto"
,
returngv
=
False
,
seed
=
0
):
"""Draw a graph using graphviz."""
if
g
.
is_directed
():
...
...
@@ -51,7 +52,7 @@ def graph_draw(g, pos=None, size=(15,15), pin=False, layout="neato",
if
splines
:
gv
.
setv
(
gvg
,
"splines"
,
"true"
)
gv
.
setv
(
gvg
,
"ratio"
,
str
(
ratio
))
gv
.
setv
(
gvg
,
"size"
,
"%f,%f"
%
(
size
[
0
]
/
2.54
,
size
[
0
]
/
2.54
))
# centimeters
gv
.
setv
(
gvg
,
"size"
,
"%f,%f"
%
(
size
[
0
]
/
2.54
,
size
[
1
]
/
2.54
))
# centimeters
if
maxiter
!=
None
:
gv
.
setv
(
gvg
,
"maxiter"
,
str
(
maxiter
))
gv
.
setv
(
gvg
,
"start"
,
str
(
seed
if
seed
>
0
else
time
.
time
()))
...
...
@@ -70,14 +71,13 @@ def graph_draw(g, pos=None, size=(15,15), pin=False, layout="neato",
c
=
vcolor
[
v
]
minmax
[
0
]
=
min
(
c
,
minmax
[
0
])
minmax
[
1
]
=
max
(
c
,
minmax
[
1
])
print
minmax
if
vnorm
:
vnorm
=
matplotlib
.
colors
.
normalize
(
vmin
=
minmax
[
0
],
vmax
=
minmax
[
1
])
if
ecolor
!=
None
and
not
isinstance
(
ecolor
,
str
):
minmax
=
[
float
(
"inf"
),
-
float
(
"inf"
)]
for
e
in
g
.
edges
():
c
=
ecolor
[
v
]
c
=
ecolor
[
e
]
minmax
[
0
]
=
min
(
c
,
minmax
[
0
])
minmax
[
1
]
=
max
(
c
,
minmax
[
1
])
if
enorm
:
...
...
@@ -162,11 +162,12 @@ def graph_draw(g, pos=None, size=(15,15), pin=False, layout="neato",
p
=
p
.
split
(
","
)
pos
[
0
][
g
.
vertex
(
n
)]
=
float
(
p
[
0
])
pos
[
1
][
g
.
vertex
(
n
)]
=
float
(
p
[
1
])
if
output
==
None
:
output
=
""
output_format
=
"xlib"
elif
output_format
==
None
:
outout_format
=
output
.
split
(
"."
)[
-
1
]
if
output_format
==
"auto"
:
if
output
==
""
:
output_format
=
"xlib"
else
:
outout_format
=
output
.
split
(
"."
)[
-
1
]
# if using xlib we need to fork the process, otherwise good ol' graphviz
# will call exit() when the window is closed
...
...
@@ -178,5 +179,9 @@ def graph_draw(g, pos=None, size=(15,15), pin=False, layout="neato",
os
.
wait
()
else
:
gv
.
render
(
gvg
,
output_format
,
output
)
gv
.
rm
(
gvg
)
return
pos
if
returngv
:
return
pos
,
gv
else
:
gv
.
rm
(
gvg
)
return
pos
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