0

I am somewhat new to R and I am trying to plot values from real data . x axis is the time and y axis real values but in graph y axis is between 0 and 100, but the real values of y are different.

I need your help.Thank you

Im.ba
  • 11
  • 1

3 Answers3

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.
cuttlefish44
  • 6,299
  • 1
  • 15
  • 32
  • Thank you for your response, like that it works but when I read y values from txt file I can't get the same result , y axis can't dispaly real values ! – Im.ba May 26 '16 at 08:32
0

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

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

Brian Tompsett - 汤莱恩
  • 5,438
  • 68
  • 55
  • 126
Im.ba
  • 11
  • 1
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

Arun kumar mahesh
  • 2,173
  • 1
  • 14
  • 19
  • when I read y values from txt file, y-axis can't show real values, it gives me graph like that http://i.stack.imgur.com/Occhh.png – Im.ba May 26 '16 at 11:20