Commit 57fc36e1 authored by Philippe SWARTVAGHER's avatar Philippe SWARTVAGHER
Browse files

CommCompGraph: take into account legend title to shrink top plot

parent 1bb2cf70
......@@ -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
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment