Skip to content

Commit 3a7865d

Browse files
committed
[llvm-locstats] Fix labels on x-axis of comparison chart
Summary: This change makes the labels on the x-axis of a comparison chart look like: "0%", "(0%, 10%)", "[10%, 20%)", and so on. Previously, each label was the same (a concatenation of all the possible coverage buckets). Reviewers: djtodoro Subscribers: llvm-commits Tags: #llvm Differential Revision: https://reviews.llvm.org/D77155
1 parent 68e2839 commit 3a7865d

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

llvm/utils/llvm-locstats/llvm-locstats.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -121,14 +121,16 @@ def draw_location_diff(self, locstats_to_compare):
121121
ax = fig.add_subplot(111)
122122
init_plot(plt)
123123

124+
comparison_keys = list(coverage_buckets())
124125
ax.bar(buckets, self.variables_coverage_map.values(), align='edge',
125-
tick_label=self.variables_coverage_map.keys(), width=0.4,
126+
width=0.4,
126127
label='variables of {}'.format(self.file_name))
127128
ax.bar(buckets_to_compare,
128129
locstats_to_compare.variables_coverage_map.values(),
129130
color='r', align='edge', width=-0.4,
130-
tick_label=locstats_to_compare.variables_coverage_map.keys(),
131131
label='variables of {}'.format(locstats_to_compare.file_name))
132+
ax.set_xticks(range(len(comparison_keys)))
133+
ax.set_xticklabels(comparison_keys)
132134

133135
props = dict(boxstyle='round', facecolor='wheat', alpha=0.5)
134136
plt.text(0.02, 0.88,

0 commit comments

Comments
 (0)