Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(864)

Unified Diff: webrtc/rtc_tools/event_log_visualizer/plot_python.cc

Issue 2826313004: Added -show_detector_state which show the detector state in the total bitrate graph. (Closed)
Patch Set: IntervalSeries struct Created 3 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: webrtc/rtc_tools/event_log_visualizer/plot_python.cc
diff --git a/webrtc/rtc_tools/event_log_visualizer/plot_python.cc b/webrtc/rtc_tools/event_log_visualizer/plot_python.cc
index d4ae043a1b5c66f0f8651159e942197832f938ad..e9c3a5ba51c6b27b616197fb0d1574725cfa9b3c 100644
--- a/webrtc/rtc_tools/event_log_visualizer/plot_python.cc
+++ b/webrtc/rtc_tools/event_log_visualizer/plot_python.cc
@@ -74,6 +74,8 @@ void PythonPlot::Draw() {
printf("y%zu = [v for dup in y%zu for v in [dup, dup]]\n", i, i);
printf(
"plt.plot(x%zu[1:], y%zu[:-1], color=rgb_colors[%zu], "
+ "path_effects=[pe.Stroke(linewidth=2, foreground='black'), "
terelius 2017/07/04 12:22:01 Why do we need to do this at all, and why do we on
philipel 2017/07/04 12:55:10 I guess it should be configurable by whoever creat
+ "pe.Normal()], "
"label=\'%s\')\n",
i, i, i, series_list_[i].label.c_str());
} else if (series_list_[i].style == DOT_GRAPH) {
@@ -85,6 +87,36 @@ void PythonPlot::Draw() {
printf("raise Exception(\"Unknown graph type\")\n");
}
}
+
+ // IntervalSeries
terelius 2017/07/04 12:22:01 If this represents the background, shouldn't it be
philipel 2017/07/04 12:55:10 They are always in the background.
+ for (size_t i = 0; i < interval_list_.size(); i++) {
+ // List intervals
+ printf("\n# === IntervalSeries: %s ===\n",
+ interval_list_[i].label.c_str());
+ printf("i%zu = [", i);
terelius 2017/07/04 12:22:01 Maybe a longer, more explicit name for the interva
philipel 2017/07/04 12:55:10 Renamed to 'ival'.
+ if (interval_list_[i].intervals.size() > 0) {
+ printf("(%G, %G)", interval_list_[i].intervals[0].begin,
+ interval_list_[i].intervals[0].end);
+ }
+ for (size_t j = 1; j < interval_list_[i].intervals.size(); j++) {
terelius 2017/07/04 12:22:01 Maybe remove the if statement above, loop from 0 a
philipel 2017/07/04 12:55:10 This is consistent with the style above, if we wan
+ printf(", (%G, %G)", interval_list_[i].intervals[j].begin,
+ interval_list_[i].intervals[j].end);
+ }
+ printf("]\n");
+
+ printf("for i in range(0, %zu):\n", interval_list_[i].intervals.size());
+ if (interval_list_[i].orientation == IntervalSeries::kHorizontal) {
+ printf(
+ " plt.axhspan(i%zu[i][0], i%zu[i][1], facecolor='%s', "
+ "alpha=0.3)\n",
+ i, i, interval_list_[i].color.c_str());
+ } else {
+ printf(
+ " plt.axvspan(i%zu[i][0], i%zu[i][1], facecolor='%s', "
+ "alpha=0.3)\n",
+ i, i, interval_list_[i].color.c_str());
+ }
+ }
}
printf("plt.xlim(%f, %f)\n", xaxis_min_, xaxis_max_);
@@ -103,6 +135,7 @@ PythonPlotCollection::~PythonPlotCollection() {}
void PythonPlotCollection::Draw() {
printf("import matplotlib.pyplot as plt\n");
+ printf("import matplotlib.patheffects as pe\n");
printf("import colorsys\n");
for (size_t i = 0; i < plots_.size(); i++) {
printf("plt.figure(%zu)\n", i);

Powered by Google App Engine
This is Rietveld 408576698