R 重新排序标签图
我有以下功能:R 重新排序标签图,r,ggplot2,R,Ggplot2,我有以下功能: ggplot(parte2, aes(IDENTIFICADOR,MEM_A)) + geom_point() + scale_x_continuous(breaks=seq(0, 100, 5))+ scale_y_continuous(breaks=seq(0, 100000, 2000)) ggplot(parte2, aes(as.numeric(reorder(IDENTIFICADOR,MEM_A)),MEM_A)) + geom_point
ggplot(parte2, aes(IDENTIFICADOR,MEM_A)) +
geom_point() +
scale_x_continuous(breaks=seq(0, 100, 5))+
scale_y_continuous(breaks=seq(0, 100000, 2000))
ggplot(parte2, aes(as.numeric(reorder(IDENTIFICADOR,MEM_A)),MEM_A)) +
geom_point() +
scale_y_continuous(breaks=seq(0, 100000, 2000))
但是这给了我一个没有顺序的x级图形,我想顺序它,因为它的值在MEM_a中需要de identificator。有人能帮我吗
我使用以下功能:
ggplot(parte2, aes(IDENTIFICADOR,MEM_A)) +
geom_point() +
scale_x_continuous(breaks=seq(0, 100, 5))+
scale_y_continuous(breaks=seq(0, 100000, 2000))
ggplot(parte2, aes(as.numeric(reorder(IDENTIFICADOR,MEM_A)),MEM_A)) +
geom_point() +
scale_y_continuous(breaks=seq(0, 100000, 2000))
绘图顺序正确,但x轴的索引不正确
INPUT_1<-parte2[,2]
INPUT_2<-parte2[,3]
CPU_A<-parte2[,4]
MEM_A<-parte2[,5]
CPU_B<-parte2[,6]
MEM_B<-parte2[,7]
ggplot(parte2, aes(fct_reorder(IDENTIFICADOR, MEM_A, min),MEM_A)) +
geom_point()+
scale_y_continuous(breaks=seq(0, 100000, 2000))
INPUT\u 1您可能正在寻找的函数是fct\u reorder
。前一个问题的答案应该对你有所帮助,我使用了它,但仍然不起作用;(您能提供一些示例数据吗?您可以使用dput
来获得数据的可粘贴版本。当我使用scale_x_连续时,我丢失了订单,因为您使用了fct_重新排序,您的x美学现在是一个因素,因此是一个离散变量。请改用scale_x_离散。