开发者

Remove Legend In R

How I can remove the legend in a plot in R? I tried legend<-FALSE, doesn't work. Also, is there a better way to set the position of the legend? For example, is there a way I can pick the location with my cursor? And I am not开发者_运维技巧 talking about ggplot or any fancy add-ons, just regular R plotting.


In order:

  • This is related to what people tried to explain to you yesterday: Think of a script as primary means of creating your R session. In ESS, you get the script as a by-product; in RStudio you can also work with commands first and then pass those to your session. Lastly, no you can't remove a legend which has already been added to a plot, but you can hopefully re-create your graph using the saved commands.

  • Yes, since Duncan Murdoch added support for 'topleft' etc you can use logical commands:

plot(1:10)                    # simple plot
legend("bottomright", "foo")  # 'foo' in bottom-right corner
  • Yes, if you use the output of locator() as input for the legend() command.


You need to specify which plotting function is producing the legend. (Most plotting function do not plot legends by default.)

There is a locator function.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜