您可以使用以下命令修改黄砖地块的标题
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()
或者,可以通过绕过可视化工具来跳过添加Yellowbrick图例和标题的步骤
show()
和
finalize()
方法,然后使用绘图所需的任何自定义图例位置直接修改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()