Extracts legend grob from a ggplot object

get_legend(gg_plot)

Arguments

gg_plot

ggplot object from which legend will be extracted

Value

object containing legend

Examples

data(examples_data)
#> Warning: data set ‘examples_data’ not found
get_legend(hm)
#> TableGrob (5 x 5) "guide-box": 2 grobs #> z cells name #> 99_881e7ea54b5e8c6568e9ce4e2f59d04b 1 (3-3,3-3) guides #> 0 (2-4,2-4) legend.box.background #> grob #> 99_881e7ea54b5e8c6568e9ce4e2f59d04b gtable[layout] #> zeroGrob[NULL]