1 回答
TA贡献1877条经验 获得超6个赞
您可以使用该参数修改 Yellowbrick 图的标题title,并使用该size参数来增加轴的大小,这可能有助于重叠标签。大小被指定为像素尺寸的元组:
from yellowbrick.features import RadViz
from yellowbrick.datasets import load_occupancy
X, y = load_occupancy()
visualizer = RadViz(
classes=["occupied", "vacant"],
title="My custom title",
size=(800, 600)
)
visualizer.fit(X, y)
visualizer.transform(X)
visualizer.show()
或者,可以通过绕过可视化工具show()和finalize()方法来跳过添加 Yellowbrick 图例和标题的步骤,然后使用绘图所需的任何自定义图例位置直接修改 ax 对象:
from yellowbrick.features import RadViz
from yellowbrick.datasets import load_occupancy
X, y = load_occupancy()
visualizer = RadViz()
visualizer.fit(X, y)
visualizer.transform(X)
custom_viz = visualizer.ax
custom_viz.set_title("New title")
custom_viz.figure.legend(
bbox_to_anchor=(1.02, 1),
borderaxespad=0.0,
title="level",
loc=0,
)
custom_viz.figure.show()
添加回答
举报