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
ac6a7a71
Commit
ac6a7a71
authored
May 29, 2020
by
Tiago Peixoto
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
graph_draw(): fix issue with property maps being changed
This fixes issue #658
parent
c0b1794f
Pipeline
#618
passed with stage
in 587 minutes and 38 seconds
Changes
1
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
9 additions
and
10 deletions
+9
-10
src/graph_tool/draw/cairo_draw.py
src/graph_tool/draw/cairo_draw.py
+9
-10
No files found.
src/graph_tool/draw/cairo_draw.py
View file @
ac6a7a71
...
...
@@ -1084,6 +1084,9 @@ def graph_draw(g, pos=None, vprops=None, eprops=None, vorder=None, eorder=None,
adjust_default_sizes
(
g
,
(
r
-
l
,
t
-
b
),
vprops
,
eprops
)
if
ink_scale
!=
1
:
scale_ink
(
ink_scale
,
vprops
,
eprops
)
artist
=
GraphArtist
(
g
,
pos
,
vprops
,
eprops
,
ax
,
vorder
=
vorder
,
eorder
=
eorder
,
nodesfirst
=
nodesfirst
,
**
kwargs
)
...
...
@@ -1113,6 +1116,8 @@ def graph_draw(g, pos=None, vprops=None, eprops=None, vorder=None, eorder=None,
output
=
io
.
BytesIO
()
if
output
is
None
:
if
ink_scale
!=
1
:
scale_ink
(
ink_scale
,
vprops
,
eprops
)
return
interactive_window
(
g
,
pos
,
vprops
,
eprops
,
vorder
,
eorder
,
nodesfirst
,
geometry
=
output_size
,
fit_view
=
fit_view
,
**
kwargs
)
...
...
@@ -1241,13 +1246,10 @@ def adjust_default_sizes(g, geometry, vprops, eprops, force=False):
eprops
[
"font_size"
]
=
size
*
.
6
def
scale_ink
(
scale
,
vprops
,
eprops
,
copy
=
Fals
e
):
def
scale_ink
(
scale
,
vprops
,
eprops
,
copy
=
Tru
e
):
vink_props
=
[
"size"
,
"pen_width"
,
"font_size"
,
"text_out_width"
]
eink_props
=
[
"marker_size"
,
"pen_width"
,
"font_size"
,
"text_distance"
,
"text_out_width"
]
if
copy
:
vprops
=
dict
(
vprops
)
eprops
=
dict
(
eprops
)
for
p
in
vink_props
:
if
p
not
in
vprops
:
vprops
[
p
]
=
_vdefaults
[
p
]
...
...
@@ -1256,7 +1258,7 @@ def scale_ink(scale, vprops, eprops, copy=False):
vprops
[
p
]
=
vprops
[
p
].
copy
()
vprops
[
p
].
fa
*=
scale
else
:
vprops
[
p
]
=
vprops
[
p
]
*
scale
vprops
[
p
]
*=
scale
for
p
in
eink_props
:
if
p
not
in
eprops
:
eprops
[
p
]
=
_edefaults
[
p
]
...
...
@@ -1265,9 +1267,7 @@ def scale_ink(scale, vprops, eprops, copy=False):
eprops
[
p
]
=
eprops
[
p
].
copy
()
eprops
[
p
].
fa
*=
scale
else
:
eprops
[
p
]
=
eprops
[
p
]
*
scale
if
copy
:
return
vprops
,
eprops
eprops
[
p
]
*=
scale
def
get_bb
(
g
,
pos
):
pos_x
,
pos_y
=
ungroup_vector_property
(
pos
,
[
0
,
1
])
...
...
@@ -1528,8 +1528,7 @@ class GraphArtist(matplotlib.artist.Artist):
ctx
.
clip
()
ctx
.
set_matrix
(
m_s
)
vprops
,
eprops
=
scale_ink
(
np
.
mean
([
m
[
0
,
0
],
m
[
1
,
1
]]),
vprops
,
eprops
,
copy
=
True
)
scale_ink
(
np
.
mean
([
m
[
0
,
0
],
m
[
1
,
1
]]),
vprops
,
eprops
)
x
=
np
.
ones
(
3
)
for
v
in
self
.
g
.
vertices
():
...
...
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