R 用ggplot显示某些图例

R 用ggplot显示某些图例,r,ggplot2,R,Ggplot2,我有下面的plto 我如何: (1) 删除Size图例 (2) 使条形图的颜色为蓝色,且图例显示为“条形图图例”。还有如何删除条形图中的黑点 (3) 将点的颜色设为红色,图例显示为“点图例” --->此外,这一行: dat$sizze = ifelse(dat$group2 ==0 ,0, 3 ) 似乎不起作用。我可以把3改成1或5,但情节看起来还是一样。你知道如何让它发挥作用吗?使用指南和缩放手册: p1 <- ggplot(dat, aes(x = label, y = group1

我有下面的plto

我如何:

(1) 删除Size图例

(2) 使条形图的颜色为蓝色,且图例显示为“条形图图例”。还有如何删除条形图中的黑点

(3) 将点的颜色设为红色,图例显示为“点图例”

--->此外,这一行:

dat$sizze = ifelse(dat$group2 ==0 ,0, 3 )

似乎不起作用。我可以把3改成1或5,但情节看起来还是一样。你知道如何让它发挥作用吗?

使用
指南和
缩放手册

p1 <- ggplot(dat, aes(x = label, y = group1, fill = color1))+
  geom_bar(stat="identity")  +
  geom_point(data = dat, aes(x = label, y = group2, color = color12, size = sizze), shape=15)

p1 + 
  guides(size = FALSE)+
  scale_fill_manual(values = c('blue' = 'blue'),
                    name = 'bar legend')+
  scale_colour_manual(values = c('red' = 'red'),
                      name = 'point legend')

p1使用
指南
比例*\u手册

p1 <- ggplot(dat, aes(x = label, y = group1, fill = color1))+
  geom_bar(stat="identity")  +
  geom_point(data = dat, aes(x = label, y = group2, color = color12, size = sizze), shape=15)

p1 + 
  guides(size = FALSE)+
  scale_fill_manual(values = c('blue' = 'blue'),
                    name = 'bar legend')+
  scale_colour_manual(values = c('red' = 'red'),
                      name = 'point legend')

p1如果将填充条移动到
geom_条
,则条形图图例中的“黑点”将被删除(例如
geom_条(stat=“identity”,aes(fill=color1))
谢谢。你能看到问题的底部编辑吗?当我更改它时,大小不会改变。你可能想尝试使用
scale\u size
功能并玩
range
arguments添加
scale\u size(range=c(3,6))
到绘图的最后一行如果你将填充线移动到
geom\u bar
,则条形图图例中的“黑点”将被删除(例如
geom_bar(stat=“identity”,aes(fill=color1))
谢谢。你能看到问题的底部编辑吗?我更改它时大小没有改变。你可能想试着使用
scale_size
函数并玩
range
argumentadd
scale_size(range=c(3,6))
到绘图的最后一行