我正在尝试翻转轴,使Features
位于X轴上。以下代码给了我一个错误,系统覆盖了轴。
>gplt = xgb.ggplot.importance (importance_matrix = xgb.importance(model =model_xgb) , top_n = 10 , n_clusters = 1 )
+theme(legend.position = "none" , text = element_text(size = 20))
>gplt +coord_flip()
#[OUTPUT]:
Coordinate system already present. Adding new coordinate system, which will replace the existing one.
如果你查看xgb.ggplot.importance
的代码,你会发现它包含一个对coord_flip
的调用,并且调用它两次不会改变任何东西。为了得到你想要的,你可以做
gplt + coord_cartesian()
您仍然会看到该消息,但您的轴应该被翻转。