Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
X
X-Lap
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Analytics
Analytics
Repository
Value Stream
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Commits
Open sidebar
LARN
X-Lap
Commits
06f1d772
Commit
06f1d772
authored
Feb 14, 2018
by
Andreas Schmidt
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix graph.
parent
87ed00ce
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
11 additions
and
11 deletions
+11
-11
latency-criticality.pdf
latency-criticality.pdf
+0
-0
xlap/analyse/latency.py
xlap/analyse/latency.py
+11
-11
No files found.
latency-criticality.pdf
0 → 100644
View file @
06f1d772
File added
xlap/analyse/latency.py
View file @
06f1d772
...
...
@@ -120,27 +120,27 @@ def _plot_controlflow_graph(df, hdb):
# Taken from: http://composition.al/blog/2015/11/29/a-better-way-to-add-labels-to-bar-charts-with-matplotlib/
def
autolabel
(
rects
,
ax
,
labels
):
# Get y-axis height to calculate label position from.
(
y_bottom
,
y_top
)
=
ax
.
get_y
lim
()
y_height
=
y_top
-
y_bottom
(
x_left
,
x_right
)
=
ax
.
get_x
lim
()
x_width
=
x_right
-
x_left
for
i
,
rect
in
enumerate
(
rects
):
height
=
rect
.
get_height
()
width
=
rect
.
get_width
()
color
=
"black"
align
=
"left"
# Fraction of axis height taken up by this rectangle
p_
height
=
(
height
/
y_height
)
p_
width
=
(
width
/
x_width
)
# If we can fit the label above the column, do that;
# otherwise, put it inside the column.
if
p_
height
>
0.50
:
# arbitrary; 95% looked good to me.
label_position
=
0.01
if
p_
width
>
0.50
:
# arbitrary; 95% looked good to me.
label_position
=
width
-
(
x_width
)
+
0.7
color
=
"white"
align
=
"right"
else
:
label_position
=
height
+
(
y_height
*
0.01
)
label_position
=
width
+
(
x_width
*
0.01
)
ax
.
text
(
rect
.
get_x
()
+
rect
.
get_width
()
/
2.
,
label_position
,
labels
[
i
],
ha
=
'center'
,
va
=
'bottom'
,
rotation
=
90
,
color
=
color
)
ax
.
text
(
label_position
,
rect
.
get_y
(),
labels
[
i
],
ha
=
align
,
va
=
'bottom'
,
rotation
=
0
,
color
=
color
)
def
_plot_critical_regions
(
df
,
hdb
):
...
...
@@ -156,7 +156,7 @@ def _plot_critical_regions(df,hdb):
correlations
=
list
(
map
(
lambda
x
:
x
[
'Correlation'
],
relevant
))
ticks
=
list
(
map
(
lambda
x
:
"%s-%s"
%
(
x
[
'Start'
][:
-
2
],
x
[
'End'
][:
-
2
]),
relevant
))
fig
,
ax
=
plt
.
subplots
()
rects
=
ax
.
bar
(
x
,
correlations
,
align
=
"center"
,
tick_label
=
""
)
rects
=
ax
.
bar
h
(
x
,
correlations
,
align
=
"center"
,
tick_label
=
""
)
autolabel
(
rects
,
ax
,
ticks
)
# TODO: find a more elegant solution for the label text
...
...
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