enter link description here我想引用 DEPTH(m)(y 轴)而不是引用 VMR(x 轴)连接 ggplot 中的点。
这是我使用的代码:
sp<- ggplot(profiles, aes(x=mean_VLP_ml/avg_cells_ml, y=depth_m)) +
geom_point(aes(col=avg_cells_ml, size=mean_VLP_ml)) +
ggtitle("Virus to microbe ratio (VMR) with depth (m)") +
xlab("VMR") +
ylab("Depth_m") +
theme(axis.title.y = element_blank()) + scale_y_reverse() +
expand_limits(y=c(3, 21))
我怎样才能做到这一点?我已将数据集附加到谷歌链接。
没有数据集的示例,我猜测沿着 y 轴重新排序数据然后添加 geom_path...
sp <- profiles %>%
arrange(depth_m) %>%
ggplot(aes(x=mean_VLP_ml/avg_cells_ml, y=depth_m)) +
geom_point(aes(col=avg_cells_ml, size=mean_VLP_ml)) +
geom_path() +
ggtitle("Virus to microbe ratio (VMR) with depth (m)") +
xlab("VMR") +
ylab("Depth_m") +
theme(axis.title.y = element_blank()) + scale_y_reverse() +
expand_limits(y=c(3, 21))
相似与不同
sp <- mtcars %>%
arrange(hp) %>%
ggplot(aes(x=disp, y=hp)) +
geom_point() +
geom_path()
和
sp <- mtcars %>%
arrange(disp) %>%
ggplot(aes(x=disp, y=hp)) +
geom_point() +
geom_path()