Skip to content

Commit 4563954

Browse files
author
Aravind Sankaran
committed
Now unit can be passed as arg
1 parent 9a128b9 commit 4563954

1 file changed

Lines changed: 4 additions & 6 deletions

File tree

partial_ranker/measurements_visualizer.py

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -108,7 +108,7 @@ def show_measurement_histograms(self, obj_list:List=None, bins=10, hspace=0.5):
108108
plt.subplots_adjust(hspace=hspace)
109109
plt.show()
110110

111-
def show_measurements_boxplots(self, obj_list=None, outliers=False, scale=1.5, tick_size=12):
111+
def show_measurements_boxplots(self, obj_list=None, outliers=False, scale=1.5, tick_size=12, unit='time (s)'):
112112
"""Displays a graph with a boxplot of measurements for each object in obj_list. The box represents the Inter Quartile Interval (IQI),
113113
which is the interval between the 25th and the 75th quantile values, and the red line within the box represents the median value.
114114
@@ -117,6 +117,7 @@ def show_measurements_boxplots(self, obj_list=None, outliers=False, scale=1.5, t
117117
outliers (bool, optional): Include outliers to calculate the box range. Defaults to False.
118118
scale (float, optional): matplotlib param to control the size of the plot. Defaults to 1.5.
119119
tick_size (int, optional): matplotlib param to control the size of the axis labels. Defaults to 12.
120+
unit (str, optional): The unit of the measurement values. Defaults to 'time (s)'.
120121
121122
Returns:
122123
matplotlib.pyplot.figure
@@ -181,7 +182,7 @@ def show_measurements_boxplots(self, obj_list=None, outliers=False, scale=1.5, t
181182
ax.get_yaxis().tick_left()
182183
ax.xaxis.set_tick_params(labelsize=tick_size)
183184
ax.yaxis.set_tick_params(labelsize=tick_size)
184-
ax.set_xlabel('time (s)', fontsize = tick_size)
185+
ax.set_xlabel(unit, fontsize = tick_size)
185186

186187
#plt.show()
187188
return fig
@@ -264,7 +265,4 @@ def show_measurements_violinplot(self, obj_list=None, outliers=False, scale=1.5)
264265
ax.set_xlabel('time (s)')
265266

266267
#plt.show()
267-
return fig
268-
269-
270-
268+
return fig

0 commit comments

Comments
 (0)