仅绘制y轴,但没有别的

use*_*765 2 r ggplot2

我想创建一个只显示y轴(包括网格,数字和标签)的图.但我不想显示图或x轴.

这可能吗?

csg*_*pie 8

创建绘图时,只需指定几个选项即可.特别注意axes,type并且xlab:

plot(runif(10), runif(10), 
     xlim=c(0, 1), ylim=c(0,1), 
     axes=FALSE, #Don't plot the axis 
     type="n",  #hide the points
     ylab="", xlab="") #No axis labels
Run Code Online (Sandbox Code Playgroud)

然后,您可以手动添加y轴:

axis(2, seq(0, 1, 0.2))
Run Code Online (Sandbox Code Playgroud)

并根据需要添加网格

grid(lwd=2)
Run Code Online (Sandbox Code Playgroud)