Re: [R] various plotting options

From: Michael Friendly <friendly_at_yorku.ca>
Date: Thu, 24 Mar 2011 08:39:13 -0400

On 3/23/2011 10:27 AM, Grossmann Patrick wrote:
> Dear R-Project helpdesk member,
>
> I am currently working on some basic correspondence analysis using the R packages 'ca'. As I compute the CA by example<- ca(data), and plotting example via plot(example), I am trying to figure out, how to get a certain desired plot, so, however, my question could be of more general nature.
>
> This probably might not be new to you, but the plotting the result of ca will return a plot, with red points (triangles if I remember correctly) labeled with the column names of the original table read in, and blue dots for the row names. What I essentially need to solve is, to make a plot, which differs in the visualization of the rows. The labels of the rows should not be displayed at all, plus, certain rows must have a different color of other rows. Of course, I looked up several manuals and threads already, but unfortunatly I was not able to get very far beyond "plot(example, labels=0)".
>
> So let us say, I have a table, which looks like this
> a b c d
> a 1 2 3
> b 4 5 6
> c 7 8 9
> d 0 1 2
>
> with a b c d being the header, and the row.names=1, what I practically need is a plot, that displays the column names attached as labels to the corresponding dots/triangles (which is the default case), and the dots referring to the rows without(!) any labels, PLUS the points corresponding to the first two rows (a=1 2 3, b = 4 5 6) in a different color (really does not matter which) than the points corresponding to the last two ones (c = 7 8 9, d = 0 1 2).
>
> I deeply hope, that you are able to help me; if I can help you considering the formulation of my question, please feel free, to contact me.

[First: please use a more specific and informative subject line in posts to R-help]

The plot function in the ca package is a bit crippled, since you have no control over the colors/plot symbols for subsets of the row/col points, so I'm afraid you can't do what you want with the current CRAN version.

I modified ca::plot.ca.r to return the matrix of coordinates actually plotted, allowing me to use points() and lines() after the call. I can send that to you if you like.

HTH

-- 
Michael Friendly     Email: friendly AT yorku DOT ca
Professor, Psychology Dept.
York University      Voice: 416 736-5115 x66249 Fax: 416 736-5814
4700 Keele Street    Web:   http://www.datavis.ca
Toronto, ONT  M3J 1P3 CANADA

______________________________________________
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.
Received on Thu 24 Mar 2011 - 12:43:30 GMT

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.2.0, at Thu 24 Mar 2011 - 12:50:23 GMT.

Mailing list information is available at https://stat.ethz.ch/mailman/listinfo/r-help. Please read the posting guide before posting to the list.

list of date sections of archive