本文整理汇总了Python中naarad.metrics.metric.Metric.plot_timeseries方法的典型用法代码示例。如果您正苦于以下问题:Python Metric.plot_timeseries方法的具体用法?Python Metric.plot_timeseries怎么用?Python Metric.plot_timeseries使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类naarad.metrics.metric.Metric
的用法示例。
在下文中一共展示了Metric.plot_timeseries方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: plot_timeseries
# 需要导入模块: from naarad.metrics.metric import Metric [as 别名]
# 或者: from naarad.metrics.metric.Metric import plot_timeseries [as 别名]
def plot_timeseries(self, graphing_library='matplotlib'):
if graphing_library != 'matplotlib':
return Metric.plot_timeseries(self, graphing_library)
else:
logger.info('Using graphing_library {lib} for metric {name}'.format(lib=graphing_library, name=self.label))
plot_data = {}
# plot time series data for submetrics
for out_csv in sorted(self.csv_files, reverse=True):
csv_filename = os.path.basename(out_csv)
# The last element is .csv, don't need that in the name of the chart
column = csv_filename.split('.')[-2]
transaction_name = ' '.join(csv_filename.split('.')[1:-2])
plot = PD(input_csv=out_csv, csv_column=1, series_name=transaction_name,
y_label=self.sub_metric_description[column] + ' (' + self.sub_metric_units[column] + ')', precision=None, graph_height=500, graph_width=1200,
graph_type='line')
if transaction_name in plot_data:
plot_data[transaction_name].append(plot)
else:
plot_data[transaction_name] = [plot]
for transaction in plot_data:
graphed, div_file = Metric.graphing_modules[graphing_library].graph_data(plot_data[transaction], self.resource_directory, self.resource_path,
self.label + '.' + transaction)
if graphed:
self.plot_files.append(div_file)
return True