相关疑难解决方法(0)

如何更改ggplot2构面的顺序

我有一个具有以下结构的数据帧“ pd.long”:

> str(pd.long)
'data.frame':   144 obs. of  3 variables:
$ Site   : Factor w/ 12 levels "BED","BEU","EB",..: 8 9 10 3 11 1 6 7 5 4 ...
$ Month  : Factor w/ 12 levels "Dec","Jan","Feb",..: 1 1 1 1 1 1 1 1 1 1 ...
$ Density: int  20 20 20 20 20 20 20 20 20 20 ...
Run Code Online (Sandbox Code Playgroud)

我用这段代码构建了条形图:

ggplot(pd.long, aes(x=Month, y=Density, fill=Site))+
geom_bar(stat = "identity", position = "dodge", fill = "darkgray")+
xlab("Month") + ylab("Number")+
facet_wrap(~Site, …
Run Code Online (Sandbox Code Playgroud)

r ggplot2

4
推荐指数
1
解决办法
3406
查看次数

标签 统计

ggplot2 ×1

r ×1