Commit ee725410 authored by Philippe SWARTVAGHER's avatar Philippe SWARTVAGHER
Browse files

CommCompGraph: add title_fontweight attribute

parent b6ddcbbf
......@@ -719,6 +719,8 @@ class CommCompGraph:
Whether the legend has to be displayed or not, default to True.
title : str
The plot title.
title_fontweight : {a numeric value in range 0-1000, 'ultralight', 'light', 'normal', 'regular', 'book', 'medium', 'roman', 'semibold', 'demibold', 'demi', 'bold', 'heavy', 'extra bold', 'black'}
The font weight of the plot title, default to "normal".
"""
_X_LABELS = {
"byte": "Size of transmitted data",
......@@ -728,7 +730,7 @@ class CommCompGraph:
_FILL_ALPHA = 0.3
_nb_instances = 1 # to interleave generation of several plots, plt.figure indexing starts with 1
def __init__(self, x_range, x_type: str, comm_type: CommCompGraphCommType, comp_type: CompType, comp_metric: CompMetric, comm_legend_title=None, comp_legend_title=None, title=None, legend_fontsize="medium", x_span_zone=None):
def __init__(self, x_range, x_type: str, comm_type: CommCompGraphCommType, comp_type: CompType, comp_metric: CompMetric, comm_legend_title=None, comp_legend_title=None, title=None, title_fontweight="normal", legend_fontsize="medium", x_span_zone=None):
if x_type not in self._X_LABELS:
raise Exception("Unknown x_type " + x_type)
......@@ -758,6 +760,7 @@ class CommCompGraph:
self.x_end = None
self.display_legend = True
self.title = title
self.title_fontweight = title_fontweight
self._left_y_max = 0
self._right_y_max = 0
self._instance_id = CommCompGraph._nb_instances
......@@ -841,9 +844,9 @@ class CommCompGraph:
if self.title is not None:
if self.display_legend:
self._fig.suptitle(self.title)
self._fig.suptitle(self.title, fontweight=self.title_fontweight)
else:
self._ax.set(title=self.title)
self._ax.set(title=self.title, fontweight=self.title_fontweight)
shrink_plot_x_label = 0.1
if self._x_type == "cursor":
......
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