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

Side by Side Diff: webrtc/rtc_tools/event_log_visualizer/plot_python.cc

Issue 2997883002: Video/Screenshare loopback tool.
Patch Set: Rebase Created 3 years, 3 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/main.cc ('k') | webrtc/system_wrappers/include/clock.h » ('j') | 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 73 matching lines...) Expand 10 before | Expand all | Expand 10 after
84 printf( 84 printf(
85 "plt.plot(x%zu, y%zu, color=rgb_colors[%zu], label=\'%s\', " 85 "plt.plot(x%zu, y%zu, color=rgb_colors[%zu], label=\'%s\', "
86 "marker='o', ls=' ')\n", 86 "marker='o', ls=' ')\n",
87 i, i, i, series_list_[i].label.c_str()); 87 i, i, i, series_list_[i].label.c_str());
88 } else { 88 } else {
89 printf("raise Exception(\"Unknown graph type\")\n"); 89 printf("raise Exception(\"Unknown graph type\")\n");
90 } 90 }
91 } 91 }
92 92
93 // IntervalSeries 93 // IntervalSeries
94 printf("interval_colors = ['#ff8e82','#5092fc','#c4ffc4']\n"); 94 printf("interval_colors = ['#ff8e82','#5092fc','#c4ffc4', '#555555']\n");
95 RTC_CHECK_LE(interval_list_.size(), 3); 95 RTC_CHECK_LE(interval_list_.size(), 4);
96 // To get the intervals to show up in the legend we have to created patches 96 // To get the intervals to show up in the legend we have to created patches
97 // for them. 97 // for them.
98 printf("legend_patches = []\n"); 98 printf("legend_patches = []\n");
99 for (size_t i = 0; i < interval_list_.size(); i++) { 99 for (size_t i = 0; i < interval_list_.size(); i++) {
100 // List intervals 100 // List intervals
101 printf("\n# === IntervalSeries: %s ===\n", 101 printf("\n# === IntervalSeries: %s ===\n",
102 interval_list_[i].label.c_str()); 102 interval_list_[i].label.c_str());
103 printf("ival%zu = [", i); 103 printf("ival%zu = [", i);
104 if (interval_list_[i].intervals.size() > 0) { 104 if (interval_list_[i].intervals.size() > 0) {
105 printf("(%G, %G)", interval_list_[i].intervals[0].begin, 105 printf("(%G, %G)", interval_list_[i].intervals[0].begin,
106 interval_list_[i].intervals[0].end); 106 interval_list_[i].intervals[0].end);
107 } 107 }
108 for (size_t j = 1; j < interval_list_[i].intervals.size(); j++) { 108 for (size_t j = 1; j < interval_list_[i].intervals.size(); j++) {
109 printf(", (%G, %G)", interval_list_[i].intervals[j].begin, 109 printf(", (%G, %G)", interval_list_[i].intervals[j].begin,
110 interval_list_[i].intervals[j].end); 110 interval_list_[i].intervals[j].end);
111 } 111 }
112 printf("]\n"); 112 printf("]\n");
113 113
114 printf("for i in range(0, %zu):\n", interval_list_[i].intervals.size()); 114 printf("for i in range(0, %zu):\n", interval_list_[i].intervals.size());
115 if (interval_list_[i].orientation == IntervalSeries::kVertical) { 115 if (interval_list_[i].orientation == IntervalSeries::kVertical) {
116 printf( 116 printf(
117 " plt.axhspan(ival%zu[i][0], ival%zu[i][1], " 117 " plt.axhspan(ival%zu[i][0], ival%zu[i][1], "
118 "facecolor=interval_colors[%zu], " 118 "facecolor=interval_colors[%zu], "
119 "alpha=0.3)\n", 119 "alpha=0.3)\n",
120 i, i, i); 120 i, i, i);
121 } else { 121 } else {
122 printf( 122 if (i < 3) {
123 " plt.axvspan(ival%zu[i][0], ival%zu[i][1], " 123 printf(
124 "facecolor=interval_colors[%zu], " 124 " plt.axvspan(ival%zu[i][0], ival%zu[i][1], "
125 "alpha=0.3)\n", 125 "facecolor=interval_colors[%zu], "
126 i, i, i); 126 "alpha=0.3)\n",
127 i, i, i);
128 } else {
129 printf(
130 " plt.axvspan(ival%zu[i][0], ival%zu[i][1], "
131 "color=\"none\", "
132 "hatch = '/', "
133 "alpha=0.15)\n",
134 i, i);
135 }
127 } 136 }
128 printf( 137 printf(
129 "legend_patches.append(mpatches.Patch(ec=\'black\', " 138 "legend_patches.append(mpatches.Patch(ec=\'black\', "
130 "fc=interval_colors[%zu], label='%s'))\n", 139 "fc=interval_colors[%zu], label='%s'))\n",
131 i, interval_list_[i].label.c_str()); 140 i, interval_list_[i].label.c_str());
132 } 141 }
133 } 142 }
134 143
135 printf("plt.xlim(%f, %f)\n", xaxis_min_, xaxis_max_); 144 printf("plt.xlim(%f, %f)\n", xaxis_min_, xaxis_max_);
136 printf("plt.ylim(%f, %f)\n", yaxis_min_, yaxis_max_); 145 printf("plt.ylim(%f, %f)\n", yaxis_min_, yaxis_max_);
(...skipping 26 matching lines...) Expand all
163 } 172 }
164 173
165 Plot* PythonPlotCollection::AppendNewPlot() { 174 Plot* PythonPlotCollection::AppendNewPlot() {
166 Plot* plot = new PythonPlot(); 175 Plot* plot = new PythonPlot();
167 plots_.push_back(std::unique_ptr<Plot>(plot)); 176 plots_.push_back(std::unique_ptr<Plot>(plot));
168 return plot; 177 return plot;
169 } 178 }
170 179
171 } // namespace plotting 180 } // namespace plotting
172 } // namespace webrtc 181 } // namespace webrtc
OLDNEW
« no previous file with comments | « webrtc/rtc_tools/event_log_visualizer/main.cc ('k') | webrtc/system_wrappers/include/clock.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698