如何将散景图例放在 'bottom_right'

How to put Bokeh legend on the 'bottom_right'

我正在尝试使用 Bokeh 生成 ROC 曲线。我有以下用于 运行 之前的代码,但现在我收到一条错误消息:ValueError: invalid value: 'bottom_right';允许的值为水平或垂直

p = figure(title='ROC Curve: Logistic Regression', width=800, height=800)

p.line(x=fpr, y=tpr, legend='ROC Curve: Area Under Curve = %0.3f' %roc_auc)
p.legend.orientation = 'bottom_right'
p.xaxis.axis_label = 'False Positive Rate'
p.yaxis.axis_label = 'True Positive Rate'
show(p)

我只想将图例放在屏幕底部,这样它就不会覆盖部分曲线。有人可以建议吗?谢谢

您想设置 location,而不是 orientation

p.legend.location = 'bottom_right'

https://docs.bokeh.org/en/latest/docs/user_guide/styling.html#location