1 回答

TA貢獻1877條經(jīng)驗 獲得超6個贊
您可以使用該參數(shù)修改 Yellowbrick 圖的標(biāo)題title,并使用該size參數(shù)來增加軸的大小,這可能有助于重疊標(biāo)簽。大小被指定為像素尺寸的元組:
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 圖例和標(biāo)題的步驟,然后使用繪圖所需的任何自定義圖例位置直接修改 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()
添加回答
舉報