如何在此图表中按
Fuel
(即标记为黑点的净值)对 value_out.net
进行排序?
请看图和下面的代码:
fuels_out_plot_w_tot_order <- ggplot() +
geom_bar(data = all_fuels, aes(x = Fuel, y = value_out, fill = stage_emission), stat = "identity") +
geom_point(data = all_fuels, aes(x = Fuel, y = value_out.net), size = 1) +
scale_y_continuous("g CO2e/kWh",
sec.axis = sec_axis(~ . / conv_mj_kwh, name = "g CO2e/MJ")) +
theme(legend.title = element_blank()) +
ggtitle("Well-to-wheel emissions (powertrain efficiency considered)") +
coord_flip(); fuels_out_plot_w_tot_order
我尝试了
reorder()
,但我无法让它工作。
所有燃料 <- all_fuels %>% 变异(燃料 = forcats::fct_reorder(燃料,value_out.net))