[R] graphics question

Jonathan Baron baron at cattell.psych.upenn.edu
Wed May 15 18:45:43 CEST 2002

On 05/15/02 17:30, Paul Lemmens wrote:
>after browsing the documentation and web, I'm completely lost as how to 
>create the graph I describe below (as best as I can).
>I've got 3 pairs of average response times: (390,396), (416, 421), 
>(406,415). Each of these pairs represents a level of a certain factor 
>(let's call it 'loc'), namely (in the same order), levels "c", "nc" and 
>"ni". Within a pair, the first value belongs to the level "sc" of the 
>factor 'cat'; the second value belongs to the level "oc".
>The graph I'm looking for has on the y-axis the RT values (in ms), so this 
>should range from 350 - 450. On the x-axis I want two ticks for each level 
>(sc and oc) of the 'cat' factor. In the plot, three lines should be 
>displayed, for each level of the factor 'loc', pref. including a legend.

I'm not going to solve the whole thing, but I think what you want
is matplot(m1,typ="l"), where m1 is a matrix made from your data
above.  (I think it would go like

390 396
416 421
406 415

but I might have it transposed.  I always ending up trying t(m1)
because I never remember which way it goes so I guess rather than
reading the help page.)  You might be able to get proper labels
by using colnames(x) and rownames(x).  After the plot, you can
use legend() to add a legend.


Jonathan Baron, Professor of Psychology, University of Pennsylvania
Home page: http://www.sas.upenn.edu/~baron
r-help mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html
Send "info", "help", or "[un]subscribe"
(in the "body", not the subject !)  To: r-help-request at stat.math.ethz.ch

More information about the R-help mailing list