[R] Plot creates a straigth line

jim holtman jholtman at gmail.com
Wed Oct 20 21:00:27 CEST 2010


'plot' is doing exactly what you are asking it to do.  Take a close
look at your data:

      cyto_std_conc    od
 [1,]     11.371777 10.00
 [2,]      9.786814  8.00
 [3,]      8.201852  6.00
 [4,]      6.616889  4.00
 [5,]      5.031927  2.00
 [6,]      3.446964  1.00
 [7,]     11.371777 10.50
 [8,]      9.786814  7.80
 [9,]      8.201852  6.40
[10,]      6.616889  3.80
[11,]      5.031927  2.10
[12,]      3.446964  0.95
>

see between the 6th and 7th values you are asking it to draw a line
from the lowest to highest.  You want split your plotting into
'plot(data[1:6])' and lines(data[7:12]) to avoid the straight line.
But should should away look at your data to see if that is what you
intended.

On Wed, Oct 20, 2010 at 11:18 AM, 1Rnwb <sbpurohit at gmail.com> wrote:
>
> Hello all, I am using 'plot' to create standard curves for elisa data. when I
> use 'plot' with type='b' i get the points connected with lines and one
> straigth line from the lowest datapoint to the highest data point. how can i
> avoid/remove it from the figure. i am using R2.9.1, below is the example of
> the data.
>
> od<-c(10, 8, 6,4,2,1, 10.5,7.8,6.4,3.8,2.1,0.95)
>
> cyto_conc=2650                          # Highest cytokine concentration user defined
>
> cyto_std_conc <-c(cyto_conc)
>
> for (i in 1:5)
>     {
>        cyto_conc = cyto_conc /3
>        cyto_std_conc <-c(cyto_std_conc ,cyto_conc)
>     }
> cyto_std_conc<-log2(rep(cyto_std_conc,2))
> cyto<-cbind(cyto_std_conc,od)
>
> plot(cyto_std_conc,od, type='b')
>
> I have searched help using '?plot' in R as well as google, all the examples
> which are available online gives me the plot the way it is shown in the
> example. but when i use the plot for my data it gives me a straight line.
> thanks
> sharad
> --
> View this message in context: http://r.789695.n4.nabble.com/Plot-creates-a-straigth-line-tp3004090p3004090.html
> Sent from the R help mailing list archive at Nabble.com.
>
> ______________________________________________
> R-help at r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
>



-- 
Jim Holtman
Cincinnati, OH
+1 513 646 9390

What is the problem that you are trying to solve?



More information about the R-help mailing list