当有多个时,删除ggplot2中的额外图例

qed*_*qed 1 graphics r ggplot2

例如:

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..)) 
Run Code Online (Sandbox Code Playgroud)

在此输入图像描述

旁边有两个传说,我可以删除其中一个吗?

col*_*oll 5

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

你需要的是

v1 = v +  stat_contour(aes(colour=..level..,size=..level..)) + 
scale_colour_continuous(guide=FALSE)
Run Code Online (Sandbox Code Playgroud)

用于scale_size_continuous关闭尺寸图例.