15
12

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

ggplot2で凡例を消す。

Last updated at Posted at 2018-01-12
## 特定の凡例(colour)を消す1
p + guides(colour=FALSE)
## 特定の凡例(colour)を消す2
p + scale_colour_discrete(guide=FALSE)
## 全ての凡例を消す
p + theme(legend.position = 'none')

library(ggplot2)

p <- ggplot(mtcars, aes(wt, mpg)) + geom_point(aes(colour = factor(cyl)))
## 凡例あり
p

## 凡例なし
p + guides(colour=FALSE)
p + scale_colour_discrete(guide=FALSE)
p + theme(legend.position = 'none')

mtcarsは自動車の燃費等に関するデータセット(32台分)。wt: Weight (1000 lbs)、mpg: Miles/(US) gallon、cyl: Number of cylinders。

参考

15
12
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
15
12

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?