Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Philippe SWARTVAGHER
memory-contention
Commits
57fc36e1
Commit
57fc36e1
authored
Dec 16, 2021
by
Philippe SWARTVAGHER
Browse files
CommCompGraph: take into account legend title to shrink top plot
parent
1bb2cf70
Changes
1
Hide whitespace changes
Inline
Side-by-side
plot/comm_comp.py
View file @
57fc36e1
...
...
@@ -858,6 +858,7 @@ class CommCompGraph:
self
.
_fig
.
set_size_inches
(
*
self
.
fig_size
.
value
)
# Left Y axis (communications):
nb_items_comm_legend
=
0
if
self
.
_nb_comm_curves
>
0
:
if
self
.
_comm_type
==
CommCompGraphCommType
.
BANDWIDTH
:
self
.
_ax
.
set_ylabel
(
"Network Bandwidth (MB/s)"
)
...
...
@@ -865,6 +866,9 @@ class CommCompGraph:
self
.
_ax
.
set_ylabel
(
"Network Latency (µs)"
)
if
self
.
display_legend
:
nb_items_comm_legend
=
self
.
_nb_comm_curves
if
self
.
_comm_legend_title
is
not
None
:
nb_items_comm_legend
+=
1
leg
=
self
.
_ax
.
legend
(
bbox_to_anchor
=
(
-
0.17
,
1.02
,
1.34
,
0.2
),
loc
=
"lower left"
,
title
=
self
.
_comm_legend_title
,
fontsize
=
self
.
legend_fontsize
)
leg
.
_legend_box
.
align
=
"left"
...
...
@@ -879,6 +883,7 @@ class CommCompGraph:
self
.
_ax
.
set_yticks
([])
# Right Y axis (computations):
nb_items_comp_legend
=
0
if
self
.
_nb_comp_curves
>
0
:
assert
(
self
.
_ax_right
is
not
None
)
...
...
@@ -890,6 +895,9 @@ class CommCompGraph:
self
.
_ax_right
.
set_ylabel
(
self
.
_comp_type
.
y_axis_label
[
self
.
_comp_metric
])
if
self
.
display_legend
:
nb_items_comp_legend
=
self
.
_nb_comp_curves
if
self
.
_comp_legend_title
is
not
None
:
nb_items_comp_legend
+=
1
leg
=
self
.
_ax_right
.
legend
(
bbox_to_anchor
=
(
-
0.17
,
1.02
,
1.34
,
0.2
),
loc
=
"lower right"
,
markerfirst
=
False
,
title
=
self
.
_comp_legend_title
,
fontsize
=
self
.
legend_fontsize
)
leg
.
_legend_box
.
align
=
"right"
...
...
@@ -905,7 +913,7 @@ class CommCompGraph:
if
self
.
nb_curves
>
0
and
self
.
display_legend
:
plt
.
subplots_adjust
(
top
=
shrink_plot_legend
[
max
(
self
.
_nb_comm_curves
,
self
.
_nb_comp_curves
)],
bottom
=
shrink_plot_x_label
)
plt
.
subplots_adjust
(
top
=
shrink_plot_legend
[
max
(
nb_items_comm_legend
,
nb_items_comp_legend
)],
bottom
=
shrink_plot_x_label
)
self
.
_plotted
=
True
...
...
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