【问题标题】:R Correction of curves and scaleR 曲线和比例校正
【发布时间】:2022-12-07 02:15:28
【问题描述】:

我有为我生成曲线的代码:


C=c(0,0.3,1.5,3.5,19.5)
v1=c(0.00, 0.00, 0.01, 0.22, 0.84) 
v2=c(0.10, 0.74, 1.00, 1.00, 1.00)
mlist_procent = c(0.9852836, 0.7762951, 0.3899078, 0.2281043, 0.0602995)


plot_c <-plot(C, mlist_procent, type = "b", pch = 19, ylim = range(mlist_procent),
              col = "black",  xlab = "C", ylab = "means")

par(new=TRUE)
plot_c4 <-plot(C, v1, type = "b", pch = 19, ylim = range(mlist_procent),
               col = "blue", xlab = "C", ylab = "means")
par(new=TRUE)
plot_c5 <-plot(C, v2, type = "b", pch = 19, ylim = range(mlist_procent),
               col = "red", xlab = "C", ylab = "means")

我想得到一个图,其中蓝色和红色曲线是相反的,并且 y 轴上只有一个刻度。

我尝试:


plot_c <- plot(C, mlist_procent, type = "b", pch = 19, ylim = range(mlist_procent),
               col = "black", xlab = "C", ylab = "means", ann = FALSE)
par(new = TRUE)
plot_c4 <- plot(C, v1, type = "b", pch = 19, ylim = rev(range(mlist_procent)),
                col = "blue", xlab = "C", ylab = "means", ann = FALSE)
par(new = TRUE)
plot_c5 <- plot(C, v2, type = "b", pch = 19, ylim = rev(range(mlist_procent)),
                col = "red", xlab = "C", ylab = "means", ann = FALSE)

我在 y 轴上得到更多的刻度,蓝色曲线的点也更少 我需要所有曲线都有 5 个点 如何改变蓝色曲线?在绘图之前我是否需要以某种方式规范化数据?我不知道如何修复我的情节所以请帮助我

【问题讨论】:

    标签: r plot curve


    【解决方案1】:

    我认为如果我按照您的要求,您只需要使用一个 plot 语句和一个自定义 ylim 值

    这个:

    plot_c <-plot(C, mlist_procent, type = "b", pch = 19, ylim = c(0,1.1),
                  col = "black",  xlab = "C", ylab = "means")
    lines(C,v1,col="blue")
    points(C,v1,col="blue",pch=19)
    lines(C,v2,col="red")
    points(C,v2,col="red",pch=19)
    
    

    产生

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2014-09-30
      • 1970-01-01
      • 1970-01-01
      • 2017-06-20
      • 2019-04-26
      • 2015-03-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多