【发布时间】:2017-06-30 06:47:38
【问题描述】:
我正在使用seaborn.distplot (python3) 并希望每个系列有 2 个标签。
我尝试了一种 hacky 字符串格式方法,如下所示:
# bigkey and bigcount are longest string lengths of my keys and counts
label = '{{:{}s}} - {{:{}d}}'.format(bigkey, bigcount).format(key, counts['sat'][key])
在文本宽度固定的控制台中,我得到:
(-inf, 1) - 2538
[1, 3) - 7215
[3, 8) - 40334
[8, 12) - 20833
[12, 17) - 6098
[17, 20) - 499
[20, inf) - 87
我假设图中使用的字体不是固定宽度,所以我想知道是否有一种方法可以将我的图例指定为具有 2 个对齐列的标签,并且可能使用 @987654327 调用 seaborn.distplot @ 代表label kwarg(或任何有效的)。
我的情节供参考:
看起来不错,但我真的希望每个系列的 2 个标签以某种方式对齐。
【问题讨论】:
-
图例可以使用固定宽度的字体吗?
标签: python matplotlib seaborn