Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/r/79.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
R 叶绿体:控制多边形填充_R_Ggplot2 - Fatal编程技术网

R 叶绿体:控制多边形填充

R 叶绿体:控制多边形填充,r,ggplot2,R,Ggplot2,我上传了一个shapefile 然而,我相信有一个更优雅的解决方案。使用id作为建议的分组变量会导致多边形扭曲 有人有其他想法吗?多边形重叠,您可以设置alpha ggplot(plot.df, aes(x = long, y = lat)) + geom_polygon(aes(fill = factor(value), group = group), alpha = .4)+ coord_fixed() + scale_fill_manual(values = c("red",

我上传了一个shapefile

然而,我相信有一个更优雅的解决方案。使用
id
作为建议的分组变量会导致多边形扭曲


有人有其他想法吗?

多边形重叠,您可以设置
alpha

ggplot(plot.df, aes(x = long, y = lat)) +
  geom_polygon(aes(fill = factor(value), group = group), alpha = .4)+
  coord_fixed() +
  scale_fill_manual(values = c("red", "green", "blue", "orange"), breaks = c("1", "2", "3", "4")) +
  theme(legend.position = 'none')

ggplot(plot.df, aes(x=long, y=lat))+
    geom_polygon(aes(fill=factor(value), group=group))+
    geom_polygon(data=subset(plot.df, id==0), aes(fill=factor(value), group=group))+
    coord_fixed()+ 
    scale_fill_manual(values = c("red", "green", "blue", "orange"),
                breaks = c("1", "2", "3", "4"))
ggplot(plot.df, aes(x = long, y = lat)) +
  geom_polygon(aes(fill = factor(value), group = group), alpha = .4)+
  coord_fixed() +
  scale_fill_manual(values = c("red", "green", "blue", "orange"), breaks = c("1", "2", "3", "4")) +
  theme(legend.position = 'none')