0

In: "How to plot barchart onto ggplot2 map" Inscaven has proposed an efficient way for adding barplot onto a map without using subplot library.

But how adding the legend for any barplot since theme(legend.position = "topright") does not work ?

Axeman
  • 32,068
  • 8
  • 81
  • 94
vincent
  • 1
  • 1

1 Answers1

1

If you want to place the legend in the top right corner, instead of "topright" you can specify a legend position as coordinates:

ggplot(...) + theme(legend.position = c(0.9, 0.9))

(0,0) corresponds to the bottom left corner and (1,1) is top right.

Simon Larsen
  • 712
  • 3
  • 9