我有一个比例与名称的图。我试图按比例对ggplot进行排序,但是即使我对数据框进行排序,该图也要根据x轴值按字母顺序对事物进行排序。如何按y轴值排序
resultOrder <- result[order(result$Proportion), ]
ggplot() +
geom_point(aes(resultOrder$Names, resultOrder$Proportion), resultOrder) +
geom_point(shape=1) +
labs(title="Number of SVs each repeat element is found in (as a percentage, filtered for >20%)", x="TY [°C]", y="Txxx") +
#geom_point(aes(mergedGroup4$Rptname, mergedGroup4$PercentageChangeForWholeSV),mergedGroup4) + theme(axis.text.x=element_text(angle=-90)) +
xlab("Repetitive elements") +
ylab("Percentage of SVs") +
theme(axis.text.x=element_text(angle=-90)) +
theme(legend.position="top")
样本数据
Names Values Proportion
FLAM_C FLAM_C 1112 20.03965
MER112 MER112 1115 20.09371
L1MA10 L1MA10 1116 20.11173
L1PB3 L1PB3 1121 20.20184
LTR78B LTR78B 1125 20.27392
MLT1H1 MLT1H1 1126 20.29194
(TG)n (TG)n 1127 20.30997
Charlie7 Charlie7 1129 20.34601
MamRep605 MamRep605 1133 20.41809
LTR16A LTR16A 1136 20.47216
Charlie1b Charlie1b 1139 20.52622
L1PA6 L1PA6 1142 20.58028
MLT1G1 MLT1G1 1148 20.68841
LTR67B LTR67B 1150 20.72445
MER58A MER58A 1162 20.94071
DMC是正确的。
尝试一下,因为我简化了ggplot调用。对我来说,诀窍是在reorder
:中添加均值参数:
df <- read.table(file = "clipboard")
ggplot(df) +
geom_point(aes(reorder(Names, Proportion, mean), y=Proportion)) +
coord_flip()
本文收集自互联网,转载请注明来源。
如有侵权,请联系[email protected] 删除。
我来说两句