Add y-axis tick labels.

This is intended to by used for visualizing catagorical data, i.e. mapping
numerical enum values to string labels.

Bug: webrtc:10623
Change-Id: Ic9c3da9a3874f479c07412f394a774ae90fd3d7e
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/145408
Reviewed-by: Sebastian Jansson <srte@webrtc.org>
Commit-Queue: Björn Terelius <terelius@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#28656}
This commit is contained in:
Bjorn Terelius
2019-07-24 11:42:53 +02:00
committed by Commit Bot
parent 46bbdec1ab
commit 54d9602fe1
5 changed files with 32 additions and 0 deletions

View File

@ -150,6 +150,17 @@ void PythonPlot::Draw() {
printf("plt.xlabel(\'%s\')\n", xaxis_label_.c_str());
printf("plt.ylabel(\'%s\')\n", yaxis_label_.c_str());
printf("plt.title(\'%s\')\n", title_.c_str());
printf("fig = plt.gcf()\n");
printf("fig.canvas.set_window_title(\'%s\')\n", id_.c_str());
if (!yaxis_tick_labels_.empty()) {
printf("yaxis_tick_labels = [");
for (const auto& kv : yaxis_tick_labels_) {
printf("(%f,\"%s\"),", kv.first, kv.second.c_str());
}
printf("]\n");
printf("yaxis_tick_labels = list(zip(*yaxis_tick_labels))\n");
printf("plt.yticks(*yaxis_tick_labels)\n");
}
if (!series_list_.empty() || !interval_list_.empty()) {
printf("handles, labels = plt.gca().get_legend_handles_labels()\n");
printf("for lp in legend_patches:\n");