-1

The graph I plotted in ggplot looks like this:

The legend includes greek letter. Currently the legend is outside the graph. I want to move the legend inside the graph. How can I do that. The code:

p + theme(legend.position=c(1,7))

does not work. In fact it vanishes the whole legend.

Can anyone please help me?

Geotas
  • 35
  • 6

2 Answers2

0

Their values should be between 0 and 1. c(0,0) corresponds to the “bottom left” and c(1,1) corresponds to the “top right” position.

p + theme(legend.position=c(0.8,0.8))
tatxif
  • 438
  • 6
  • 10
0

You have a typo in the command. Also, legend.position uses values between 0 and 1 (see here). Try:

p + theme(legend.position = c(0.8,0.8))
Mikko
  • 7,530
  • 8
  • 55
  • 92