在 Squarify 中设置字体和自动换行



在 Matplotlib 中,我可以通过以下方式在框中绘制一个包装文本

ax.text(x_coord, y_coord, string, bbox = dict(boxstyle='round'), wrap = True, fontproperties = FontProperties_object)

我也可以通过matplotlib.font_manager.FontProperties设置字体类型。

squarify相比,它看起来很相似,因为正方形内有文字。我将如何设置字体并使用squarify进行文本换行?谢谢。

我试过这个,它有效。

text_kwargs={"fontproperties": FontProperties_object}.文本选项以"dict"形式给出,如中所述

https://github.com/laserson/squarify/blob/master/squarify/初始化.py

最新更新