SauceCat / PDPbox

python partial dependence plot toolbox
http://pdpbox.readthedocs.io/en/latest/
MIT License
840 stars 129 forks source link

After I draw the image using the following methods, I want to change the name of the x-axis and y-axis separately.What should I do? #87

Open Weidong725 opened 1 year ago

Weidong725 commented 1 year ago
plot = pdp.PDPIsolate(model=model,df=tree_temp,model_features=X.columns
                    ,feature='UrbanCPI',feature_name='UrbanCPI',n_classes=0,num_grid_points=10)
fig, axes= plot.plot(
    ncols=2,
    engine='plotly',
    template='plotly_white',
    center=False,# True为纵坐标显示原目标值-均值后的结果
    frac_to_plot=100,
    plot_params={
        "pdp_hl": True
        ,"title": {"title": {"text": ''},"subtitle": {"text": ''},}
        ,"xlabel":45
                },
    plot_pts_dist=True,
    to_bins=True,
)
SauceCat commented 1 year ago

Check this example: https://github.com/SauceCat/PDPbox/blob/master/tutorials/pdpbox_binary_classification.ipynb You can achieve this through fig.update_layout if you use plotly as the plot engine, otherwise you can do sth like this: _ = axes['bar_axes'][0].set_xticklabels(['Female', 'Male']) for matplotlib axes