我正在尝试为每个州创建一个带有条形图的地图。我用了geom_subplot2d。我有几个问题,我希望有人可以帮助解决它们
以下是生成图表的代码:
p <- ggplot() +
geom_polygon(data = total,
aes(x = x, y = y, group = region, colour = "black",
fill = cut(eval(as.symbol(var1)), 10))) +
scale_fill_brewer(palette = "Blues")
testplot <- p +
geom_subplot2d(aes(long, lat, subplot = geom_bar(aes(yy, ..count.., fill = yy))),
bins = c(25,20), ref = NULL, width = rel(0.5), data = simdat) +
scale_fill_brewer(palette = "YlGn")
print(testplot)