如何为facet_wrap
情节的每一行设置单独的y尺度?
我试过scales="free_x"
,但那不起作用。所有y刻度具有相同的最大值(见图)。非常感谢任何帮助!
ggplot() +
geom_bar(data=uws, aes(y = as.numeric(Costs), x = Scenario,
fill = Component), stat="identity",position='stack') +
ggtitle("Title") +
xlab ("Xlab") +
ylab ("Ylab") +
theme_bw() +
facet_wrap( ~ PE,scales="free_x",)
这是数据集:
Scenario;Component;PE;Costs;;;
Conv;Wastewater Conveyance;PE 5,000;1356360;;;
ConvR;Wastewater Conveyance;PE 5,000;1356360;;;
OS_6;Wastewater Conveyance;PE 5,000;0;;;
OS_200;Wastewater Conveyance;PE 5,000;0;;;
Conv;Wastewater Treatment;PE 5,000;17549257;;;
ConvR;Wastewater Treatment;PE 5,000;18587385;;;
OS_6;Wastewater Treatment;PE 5,000;7773436;;;
OS_200;Wastewater Treatment;PE 5,000;2121721;;;
Conv;Wastewater Conveyance;PE 10,000;2712720;;;
ConvR;Wastewater Conveyance;PE 10,000;2712720;;;
OS_6;Wastewater Conveyance;PE 10,000;0;;;
OS_200;Wastewater Conveyance;PE 10,000;0;;;
Conv;Wastewater Treatment;PE 10,000;28022421;;;
ConvR;Wastewater Treatment;PE 10,000;28835132;;;
OS_6;Wastewater Treatment;PE 10,000;15542442;;;
OS_200;Wastewater Treatment;PE 10,000;4243441;;;
Conv;Wastewater Conveyance;PE 50,000;13563602;;;
ConvR;Wastewater Conveyance;PE 50,000;13563602;;;
OS_6;Wastewater Conveyance;PE 50,000;0;;;
OS_200;Wastewater Conveyance;PE 50,000;0;;;
Conv;Wastewater Treatment;PE 50,000;83067897;;;
ConvR;Wastewater Treatment;PE 50,000;76961846;;;
OS_6;Wastewater Treatment;PE 50,000;77707777;;;
OS_200;Wastewater Treatment;PE 50,000;21217207;;;
Conv;Wastewater Conveyance;PE 100,000;27127203;;;
ConvR;Wastewater Conveyance;PE 100,000;27127203;;;
OS_6;Wastewater Conveyance;PE 100,000;0;;;
OS_200;Wastewater Conveyance;PE 100,000;0;;;
Conv;Wastewater Treatment;PE 100,000;132642459;;;
ConvR;Wastewater Treatment;PE 100,000;114470019;;;
OS_6;Wastewater Treatment;PE 100,000;155411123;;;
OS_200;Wastewater Treatment;PE 100,000;42434414;;;
Conv;Wastewater Conveyance;PE 500,000;135636017;;;
ConvR;Wastewater Conveyance;PE 500,000;135636017;;;
OS_6;Wastewater Conveyance;PE 500,000;0;;;
OS_200;Wastewater Conveyance;PE 500,000;0;;;
Conv;Wastewater Treatment;PE 500,000;393202029;;;
ConvR;Wastewater Treatment;PE 500,000;254368246;;;
OS_6;Wastewater Treatment;PE 500,000;777051183;;;
OS_200;Wastewater Treatment;PE 500,000;212172070;;;
Conv;Wastewater Conveyance;PE 1,000,000;271272033;;;
ConvR;Wastewater Conveyance;PE 1,000,000;271272033;;;
OS_6;Wastewater Conveyance;PE 1,000,000;0;;;
OS_200;Wastewater Conveyance;PE 1,000,000;0;;;
Conv;Wastewater Treatment;PE 1,000,000;627866807;;;
ConvR;Wastewater Treatment;PE 1,000,000;322083412;;;
OS_6;Wastewater Treatment;PE 1,000,000;1554097935;;;
OS_200;Wastewater Treatment;PE 1,000,000;424344140;;;
Conv;Wastewater Conveyance;PE 1,500,000;406908050;;;
ConvR;Wastewater Conveyance;PE 1,500,000;406908050;;;
OS_6;Wastewater Conveyance;PE 1,500,000;0;;;
OS_200;Wastewater Conveyance;PE 1,500,000;0;;;
Conv;Wastewater Treatment;PE 1,500,000;825586397;;;
ConvR;Wastewater Treatment;PE 1,500,000;346318552;;;
OS_6;Wastewater Treatment;PE 1,500,000;2331144688;;;
OS_200;Wastewater Treatment;PE 1,500,000;636516210;;;
Conv;Wastewater Conveyance;PE 2,000,000;542544067;;;
ConvR;Wastewater Conveyance;PE 2,000,000;542544067;;;
OS_6;Wastewater Conveyance;PE 2,000,000;0;;;
OS_200;Wastewater Conveyance;PE 2,000,000;0;;;
Conv;Wastewater Treatment;PE 2,000,000;1002582289;;;
ConvR;Wastewater Treatment;PE 2,000,000;346166913;;;
OS_6;Wastewater Treatment;PE 2,000,000;3108195871;;;
OS_200;Wastewater Treatment;PE 2,000,000;848688280;;;
Conv;Wastewater Conveyance;PE 2,500,000;678180083;;;
ConvR;Wastewater Conveyance;PE 2,500,000;678180083;;;
OS_6;Wastewater Conveyance;PE 2,500,000;0;;;
OS_200;Wastewater Conveyance;PE 2,500,000;0;;;
Conv;Wastewater Treatment;PE 2,500,000;1165608955;;;
ConvR;Wastewater Treatment;PE 2,500,000;329578002;;;
OS_6;Wastewater Treatment;PE 2,500,000;3885242623;;;
OS_200;Wastewater Treatment;PE 2,500,000;1060860350;;;