【问题标题】:Can not set specific values for the x axis in a plot plotting ogives无法在绘图中为 x 轴设置特定值
【发布时间】:2021-12-20 20:12:41
【问题描述】:

我正在用两个不同的 ogives 做一个情节。情节很好,y轴是正确的,但问题是x轴。 我希望 X 轴从 0 到 18.000 到 1000。但它不起作用!!

由于某种原因,没有任何工作!我所做的每个绘图的 X 轴都会发生变化。我无法设置具体值!

有人知道发生了什么吗?真的很奇怪

points<-ogive.freq(h,col="red",ylab="Frecuencia Relativa Acumulada",main="localidad")
j<-graph.freq(NiñoOK,plot=FALSE)
puntos<-ogive.freq(j,col="blue")

plot(puntos,type="b",xaxt="n",pch=19,las=1,bty="l",col="blue",ylab="Frecuencia Relativa Acumulada")
lines(points,col="red",type="b",pch=19,bty="l")
axis(1, at = seq(0, 18000, by = 1000), las=1)

我也试过了,还是不行

axis(1, at = seq(0, 14000, by = 2000),labels=c("0","2000","4000","6000"
                ,"8000","10000","12000","14000"), las=2)

【问题讨论】:

    标签: r plot


    【解决方案1】:

    我找到了解决方案! 您必须在 plot() 中添加xlim=c(0,14000)

    points<-ogive.freq(h,col="red",ylab="Frecuencia Relativa Acumulada",main="localidad")
    j<-graph.freq(NiñoOK,plot=FALSE)
    puntos<-ogive.freq(j,col="blue")
    
    plot(puntos,type="b",xaxt="n",pch=19,las=1,bty="l",col="blue",ylab="Frecuencia Relativa Acumulada")
    lines(points,col="red",type="b",pch=19,bty="l")
    axis(1, at = seq(0, 18000, by = 1000), las=1)
    

    【讨论】:

    • 请编辑您的答案并正确格式化。
    猜你喜欢
    • 2018-05-25
    • 1970-01-01
    • 1970-01-01
    • 2014-09-12
    • 2021-02-20
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2020-11-12
    相关资源
    最近更新 更多