【问题标题】:Remove extra legends in ggplot2 when there are multiple [duplicate]当有多个 [重复] 时删除 ggplot2 中的额外图例
【发布时间】:2013-11-10 10:01:31
【问题描述】:

例如:

require(ggplot2)
require(reshape2)
volcano3d <- melt(volcano) 
names(volcano3d) <- c("x", "y", "z") 
v <- ggplot(volcano3d, aes(x, y, z = z)) 
v1 = v +  stat_contour(aes(colour=..level..,size=..level..)) 

侧面有两个图例,我可以去掉一个吗?

【问题讨论】:

    标签: r graphics ggplot2


    【解决方案1】:

    请看这里: http://www.cookbook-r.com/Graphs/Legends_(ggplot2)/

    你需要的行是

    v1 = v +  stat_contour(aes(colour=..level..,size=..level..)) + 
    scale_colour_continuous(guide=FALSE)
    

    使用scale_size_continuous 关闭尺寸图例。

    【讨论】:

      猜你喜欢
      • 2012-07-27
      • 1970-01-01
      • 2021-10-01
      • 2021-11-26
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多