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

Side by Side 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: kVertical ---> kHorizontal 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 unified diff | Download patch
« no previous file with comments | « webrtc/rtc_tools/event_log_visualizer/plot_base.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright (c) 2016 The WebRTC project authors. All Rights Reserved. 2 * Copyright (c) 2016 The WebRTC project authors. All Rights Reserved.
3 * 3 *
4 * Use of this source code is governed by a BSD-style license 4 * Use of this source code is governed by a BSD-style license
5 * that can be found in the LICENSE file in the root of the source 5 * that can be found in the LICENSE file in the root of the source
6 * tree. An additional intellectual property rights grant can be found 6 * tree. An additional intellectual property rights grant can be found
7 * in the file PATENTS. All contributing project authors may 7 * in the file PATENTS. All contributing project authors may
8 * be found in the AUTHORS file in the root of the source tree. 8 * be found in the AUTHORS file in the root of the source tree.
9 */ 9 */
10 10
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after
67 "marker='.')\n", 67 "marker='.')\n",
68 i, i, i, series_list_[i].label.c_str()); 68 i, i, i, series_list_[i].label.c_str());
69 } else if (series_list_[i].style == LINE_STEP_GRAPH) { 69 } else if (series_list_[i].style == LINE_STEP_GRAPH) {
70 // Draw lines from (x[0],y[0]) to (x[1],y[0]) to (x[1],y[1]) and so on 70 // Draw lines from (x[0],y[0]) to (x[1],y[0]) to (x[1],y[1]) and so on
71 // to illustrate the "steps". This can be expressed by duplicating all 71 // to illustrate the "steps". This can be expressed by duplicating all
72 // elements except the first in x and the last in y. 72 // elements except the first in x and the last in y.
73 printf("x%zu = [v for dup in x%zu for v in [dup, dup]]\n", i, i); 73 printf("x%zu = [v for dup in x%zu for v in [dup, dup]]\n", i, i);
74 printf("y%zu = [v for dup in y%zu for v in [dup, dup]]\n", i, i); 74 printf("y%zu = [v for dup in y%zu for v in [dup, dup]]\n", i, i);
75 printf( 75 printf(
76 "plt.plot(x%zu[1:], y%zu[:-1], color=rgb_colors[%zu], " 76 "plt.plot(x%zu[1:], y%zu[:-1], color=rgb_colors[%zu], "
77 "path_effects=[pe.Stroke(linewidth=2, foreground='black'), "
78 "pe.Normal()], "
77 "label=\'%s\')\n", 79 "label=\'%s\')\n",
78 i, i, i, series_list_[i].label.c_str()); 80 i, i, i, series_list_[i].label.c_str());
79 } else if (series_list_[i].style == DOT_GRAPH) { 81 } else if (series_list_[i].style == DOT_GRAPH) {
80 printf( 82 printf(
81 "plt.plot(x%zu, y%zu, color=rgb_colors[%zu], label=\'%s\', " 83 "plt.plot(x%zu, y%zu, color=rgb_colors[%zu], label=\'%s\', "
82 "marker='o', ls=' ')\n", 84 "marker='o', ls=' ')\n",
83 i, i, i, series_list_[i].label.c_str()); 85 i, i, i, series_list_[i].label.c_str());
84 } else { 86 } else {
85 printf("raise Exception(\"Unknown graph type\")\n"); 87 printf("raise Exception(\"Unknown graph type\")\n");
86 } 88 }
87 } 89 }
90
91 // IntervalSeries
terelius 2017/07/11 21:35:52 printf("interval_colors = ['#ff8e82','#5092fc','#c
philipel 2017/07/14 11:54:57 Done.
92 for (size_t i = 0; i < interval_list_.size(); i++) {
93 // List intervals
94 printf("\n# === IntervalSeries: %s ===\n",
95 interval_list_[i].label.c_str());
96 printf("ival%zu = [", i);
97 if (interval_list_[i].intervals.size() > 0) {
98 printf("(%G, %G)", interval_list_[i].intervals[0].begin,
99 interval_list_[i].intervals[0].end);
100 }
101 for (size_t j = 1; j < interval_list_[i].intervals.size(); j++) {
102 printf(", (%G, %G)", interval_list_[i].intervals[j].begin,
103 interval_list_[i].intervals[j].end);
104 }
105 printf("]\n");
106
107 printf("for i in range(0, %zu):\n", interval_list_[i].intervals.size());
108 if (interval_list_[i].orientation == IntervalSeries::kVertical) {
109 printf(
terelius 2017/07/11 21:35:52 printf("plt.axhspan(ival%zu[i][0], ival%zu[i][1],
philipel 2017/07/14 11:54:57 Done.
110 " plt.axhspan(ival%zu[i][0], ival%zu[i][1], facecolor='%s', "
111 "alpha=0.3)\n",
112 i, i, interval_list_[i].color.c_str());
113 } else {
114 printf(
115 " plt.axvspan(ival%zu[i][0], ival%zu[i][1], facecolor='%s', "
116 "alpha=0.3)\n",
117 i, i, interval_list_[i].color.c_str());
118 }
terelius 2017/07/11 21:35:52 Is there some label that helps the user understand
philipel 2017/07/14 11:54:57 Done.
119 }
88 } 120 }
89 121
90 printf("plt.xlim(%f, %f)\n", xaxis_min_, xaxis_max_); 122 printf("plt.xlim(%f, %f)\n", xaxis_min_, xaxis_max_);
91 printf("plt.ylim(%f, %f)\n", yaxis_min_, yaxis_max_); 123 printf("plt.ylim(%f, %f)\n", yaxis_min_, yaxis_max_);
92 printf("plt.xlabel(\'%s\')\n", xaxis_label_.c_str()); 124 printf("plt.xlabel(\'%s\')\n", xaxis_label_.c_str());
93 printf("plt.ylabel(\'%s\')\n", yaxis_label_.c_str()); 125 printf("plt.ylabel(\'%s\')\n", yaxis_label_.c_str());
94 printf("plt.title(\'%s\')\n", title_.c_str()); 126 printf("plt.title(\'%s\')\n", title_.c_str());
95 if (!series_list_.empty()) { 127 if (!series_list_.empty()) {
96 printf("plt.legend(loc=\'best\', fontsize=\'small\')\n"); 128 printf("plt.legend(loc=\'best\', fontsize=\'small\')\n");
97 } 129 }
98 } 130 }
99 131
100 PythonPlotCollection::PythonPlotCollection() {} 132 PythonPlotCollection::PythonPlotCollection() {}
101 133
102 PythonPlotCollection::~PythonPlotCollection() {} 134 PythonPlotCollection::~PythonPlotCollection() {}
103 135
104 void PythonPlotCollection::Draw() { 136 void PythonPlotCollection::Draw() {
105 printf("import matplotlib.pyplot as plt\n"); 137 printf("import matplotlib.pyplot as plt\n");
138 printf("import matplotlib.patheffects as pe\n");
106 printf("import colorsys\n"); 139 printf("import colorsys\n");
107 for (size_t i = 0; i < plots_.size(); i++) { 140 for (size_t i = 0; i < plots_.size(); i++) {
108 printf("plt.figure(%zu)\n", i); 141 printf("plt.figure(%zu)\n", i);
109 plots_[i]->Draw(); 142 plots_[i]->Draw();
110 } 143 }
111 printf("plt.show()\n"); 144 printf("plt.show()\n");
112 } 145 }
113 146
114 Plot* PythonPlotCollection::AppendNewPlot() { 147 Plot* PythonPlotCollection::AppendNewPlot() {
115 Plot* plot = new PythonPlot(); 148 Plot* plot = new PythonPlot();
116 plots_.push_back(std::unique_ptr<Plot>(plot)); 149 plots_.push_back(std::unique_ptr<Plot>(plot));
117 return plot; 150 return plot;
118 } 151 }
119 152
120 } // namespace plotting 153 } // namespace plotting
121 } // namespace webrtc 154 } // namespace webrtc
OLDNEW
« no previous file with comments | « webrtc/rtc_tools/event_log_visualizer/plot_base.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698