[R] How to draw three line on the same picture ?

z_axis z_axis at 163.com
Fri Dec 11 14:00:06 CET 2009


%cat test.csv
No,HS,ZangF,ZenF
1,0.25,0.5,0.57
2,0.10,0.23,0.12
3,0.20,0.25,0.1
......
d <- read.csv("000301.txt")
matplot(d[,1], d[,-1], type='l')

It works. However, i hope the legend is displayed.

Sincerely!




z_axis wrote:
> 
> It works !  thank you very much.
> Moreover, How about reading data from file ?   The file is formatted as:
> No V1 V2 V3
> 1   0.23 0.12 0.89
> 2   0.11 0.56 0.12
> ......
> 
> 
> jholtman wrote:
>> 
>> try this:
>> 
>> x <- read.table(textConnection("No   V1  V2 V3
>> 1     0.23 0.12 0.89
>> 2     0.11 0.56 0.12"), header=TRUE)
>> matplot(x[,1], x[,-1], type='l')
>> 
>> 
>> On Fri, Dec 11, 2009 at 3:39 AM, z_axis <z_axis at 163.com> wrote:
>> 
>>>
>>> thanks for your answer ! Would you mind giving me an example using my
>>> data
>>> ?
>>>
>>> Sincerely!
>>>
>>>
>>> Patrick Connolly-4 wrote:
>>> >
>>> > On Thu, 10-Dec-2009 at 10:14PM -0800, z_axis wrote:
>>> >
>>> > |>
>>> > |> The following is  sampling data:
>>> > |> No   V1  V2 V3
>>> > |> 1     0.23 0.12 0.89
>>> > |> 2     0.11 0;56 0.12
>>> > |> .......
>>> > |>
>>> > |> I just want to draw three lines on same picture according to value
>>> of
>>> > V1, V2
>>> > |> and V3.
>>> >
>>> > ?lines
>>> >
>>> >
>>> > --
>>> >
>>> ~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.
>>> >    ___    Patrick Connolly
>>> >  {~._.~}                   Great minds discuss ideas
>>> >  _( Y )_               Average minds discuss events
>>> > (:_~*~_:)                  Small minds discuss people
>>> >  (_)-(_)                            ..... Eleanor Roosevelt
>>> >
>>> >
>>> ~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.
>>> >
>>> > ______________________________________________
>>> > 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<http://www.r-project.org/posting-guide.html>
>>> > and provide commented, minimal, self-contained, reproducible code.
>>> >
>>> >
>>>
>>> --
>>> View this message in context:
>>> http://n4.nabble.com/How-to-draw-three-line-on-the-same-picture-tp960823p960897.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<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?
>> 
>> 	[[alternative HTML version deleted]]
>> 
>> ______________________________________________
>> 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.
>> 
>> 
> 
> 

-- 
View this message in context: http://n4.nabble.com/How-to-draw-three-line-on-the-same-picture-tp960823p961035.html
Sent from the R help mailing list archive at Nabble.com.




More information about the R-help mailing list