我正在使用 seaborn.distplot
(Python3)并希望为每个系列设置两个标签。
我尝试了一个巧妙的字符串格式化方法,如下所示:
# 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个对齐列的标签,并且可能使用`tuple`调用`seaborn.distplot`的`label`参数(或任何有效的方法)。
以下是参考图表:
![enter image description here](https://istack.dev59.com/rBKK7.webp)