xgboost importance plot (ggplot) in R -
i have plotted importance matrix in xgboosot , want make text bigger, how do that?
gg <- xgb.ggplot.importance(importance_matrix = a,top_n = 15)
use theme()
increased font size.
below, have given minimum reproducible example;
# load library library(ggplot2) require(xgboost) # load data data(agaricus.train, package='xgboost') data(agaricus.test, package='xgboost') train <- agaricus.train test <- agaricus.test # create model bst <- xgboost(data = train$data, label = train$label, max.depth = 2, eta = 1, nthread = 2, nround = 2, objective = "binary:logistic") # importance matrix imp_matrix <- xgb.importance(colnames(agaricus.train$data), model = bst) # plot xgb.ggplt<-xgb.ggplot.importance(importance_matrix = imp_matrix, top_n = 4) # increase font size x , y axis xgb.ggplt+theme( text = element_text(size = 20), axis.text.x = element_text(size = 15, angle = 45, hjust = 1))
use ?theme see list of parameters can modify.
Comments
Post a Comment