Add flag to enable shared x-axis for local event log visualization.

Bug: None
Change-Id: I4aea047c905aa8acbe25fd325bc92bb65b8d0826
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/132557
Reviewed-by: Mirko Bonadei <mbonadei@webrtc.org>
Commit-Queue: Björn Terelius <terelius@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#27583}
This commit is contained in:
Bjorn Terelius
2019-04-11 18:34:01 +02:00
committed by Commit Bot
parent 0813fd504d
commit ff8cce37b6
3 changed files with 20 additions and 8 deletions

View File

@ -158,7 +158,8 @@ void PythonPlot::Draw() {
}
}
PythonPlotCollection::PythonPlotCollection() {}
PythonPlotCollection::PythonPlotCollection(bool shared_xaxis)
: shared_xaxis_(shared_xaxis) {}
PythonPlotCollection::~PythonPlotCollection() {}
@ -170,11 +171,13 @@ void PythonPlotCollection::Draw() {
printf("import colorsys\n");
for (size_t i = 0; i < plots_.size(); i++) {
printf("plt.figure(%zu)\n", i);
// Link x-axes across all figures for synchronized zooming.
if (i == 0) {
printf("axis0 = plt.subplot(111)\n");
} else {
printf("plt.subplot(111, sharex=axis0)\n");
if (shared_xaxis_) {
// Link x-axes across all figures for synchronized zooming.
if (i == 0) {
printf("axis0 = plt.subplot(111)\n");
} else {
printf("plt.subplot(111, sharex=axis0)\n");
}
}
plots_[i]->Draw();
}