R Plot - Y轴和绘制值不相同(来自txt文件的值)

时间:2016-05-24 15:14:41

标签: r plot

我对R有点新,我试图从真实数据中绘制值。 x轴是时间和y轴的实际值,但在图表y轴中介于0和100之间,但y的实际值不同。

我需要你的帮助。谢谢你

3 个答案:

答案 0 :(得分:0)

y <- c(9.21368, 8.90582, 8.92218, 8.53934, 7.99324, 7.53952, 7.51255, 7.1065, 6.91431,
       6.9704,  7.92692, 7.74947, 7.10618, 6.50479, 5.9741, 5.08136, 4.32405, 3.86809, 
       3.4377, 3.54596, 3.07406, 2.92242, 1.67285, 1.11221, 0.501673)
t <- 1 : length(y)
plot(t, y)

# Length(y) and length(t) must be same.

答案 1 :(得分:0)

y轴总是像x轴一样,但实际上不是那样:

the y-axis is always like the x axis but in reality is not like that

答案 2 :(得分:0)

You can view your y-axis values in the plot, by adding text function

    y <- c(9.21368, 8.90582, 8.92218, 8.53934, 7.99324, 7.53952, 7.51255, 7.1065, 6.91431,
           6.9704,  7.92692, 7.74947, 7.10618, 6.50479, 5.9741, 5.08136, 4.32405, 3.86809, 
           3.4377, 3.54596, 3.07406, 2.92242, 1.67285, 1.11221, 0.501673)
    t <- 1: length(y)
    plot(t,y)
    text(t,y,pos=3, cex=0.7)

enter image description here