I was just thinking of a way to present data and if it is possible in R. I have a data frame that looks as follows (this is just mockup data). df location,"species1","species2","species3","species4","species5" "loc1",0.44,0.28,0.37,-0.24,0.41 "loc2",0.54,0.62,0.34,0.52,0.71 "loc3",-0.33,0.75,-0.34,0.48,0.61 location is a factor while all the species are numerical vectors. I would like to present this as a table (or something that looks like a table) but instead of the numbers I would like to present circles (pch = 19) that increases in size with increasing number. Is it also possible to make it change color if the value is negative. (E.g. larger blue circles represent larger +values while larger red circles represent larger -values)? Jonas -- View this message in context: r.789695.n4.nabble.com/table-with-values-as-dots-in-increasing-sizes-tp3028297p3028297.html Sent from the R help mailing list archive at Nabble.com.
> install.packages("fortunes") > library(fortunes) > fortune("yoda")Evelyn Hall: I would like to know how (if) I can extract some of the information from the summary of my nlme. Simon Blomberg: This is R. There is no if. Only how. -- Evelyn Hall and Simon 'Yoda' Blomberg R-help (April 2005) df <- data.frame(matrix(rnorm(15), nrow = 3)) colnames(df) <- paste("species", 1:5, sep = "") df$location <- paste("loc", 1:3) install.packages("ggplot2") library(ggplot2) molten <- melt(df, id.vars = "location", variable_name = "species") molten$sign <- factor(sign(molten$value)) ggplot(molten, aes(x = species, y = location, colour = sign, size abs(value))) + geom_point() ggplot(molten, aes(x = species, y = location, colour = sign, size abs(value))) + geom_point() + scale_colour_manual(values = c("red", "blue")) HTH, Thierry ------------------------------------------------------------------------ ---- ir. Thierry Onkelinx Instituut voor natuur- en bosonderzoek team Biometrie & Kwaliteitszorg Gaverstraat 4 9500 Geraardsbergen Belgium Research Institute for Nature and Forest team Biometrics & Quality Assurance Gaverstraat 4 9500 Geraardsbergen Belgium tel. + 32 54/436 185 Thierry.Onkelinx at inbo.be inbo.be To call in the statistician after the experiment is done may be no more than asking him to perform a post-mortem examination: he may be able to say what the experiment died of. ~ Sir Ronald Aylmer Fisher The plural of anecdote is not data. ~ Roger Brinner The combination of some data and an aching desire for an answer does not ensure that a reasonable answer can be extracted from a given body of data. ~ John Tukey> -----Oorspronkelijk bericht----- > Van: r-help-bounces at r-project.org > [mailto:r-help-bounces at r-project.org] Namens fugelpitch > Verzonden: vrijdag 5 november 2010 9:45 > Aan: r-help at r-project.org > Onderwerp: [R] table with values as dots in increasing sizes > > > I was just thinking of a way to present data and if it is > possible in R. > > I have a data frame that looks as follows (this is just mockup data). > > df > location,"species1","species2","species3","species4","species5" > "loc1",0.44,0.28,0.37,-0.24,0.41 > "loc2",0.54,0.62,0.34,0.52,0.71 > "loc3",-0.33,0.75,-0.34,0.48,0.61 > > location is a factor while all the species are numerical vectors. > > I would like to present this as a table (or something that > looks like a > table) but instead of the numbers I would like to present > circles (pch = 19) that increases in size with increasing > number. Is it also possible to make it change color if the > value is negative. (E.g. larger blue circles represent larger > +values while larger red circles represent larger -values)? > > > Jonas > -- > View this message in context: > r.789695.n4.nabble.com/table-with-values-as-dots-in-inc > reasing-sizes-tp3028297p3028297.html > Sent from the R help mailing list archive at Nabble.com. > > ______________________________________________ > R-help at r-project.org mailing list > stat.ethz.ch/mailman/listinfo/r-help > PLEASE do read the posting guide > R-project.org/posting-guide.html > and provide commented, minimal, self-contained, reproducible code. >
Gabor Grothendieck
2010-Nov-05 11:36 UTC
[R] table with values as dots in increasing sizes
On Fri, Nov 5, 2010 at 4:45 AM, fugelpitch <jonas at runtimerecords.net> wrote:> > I was just thinking of a way to present data and if it is possible in R. > > I have a data frame that looks as follows (this is just mockup data). > > df > location,"species1","species2","species3","species4","species5" > "loc1",0.44,0.28,0.37,-0.24,0.41 > "loc2",0.54,0.62,0.34,0.52,0.71 > "loc3",-0.33,0.75,-0.34,0.48,0.61 > > location is a factor while all the species are numerical vectors. > > I would like to present this as a table (or something that looks like a > table) but instead of the numbers I would like to present circles (pch = 19) > that increases in size with increasing number. Is it also possible to make > it change color if the value is negative. (E.g. larger blue circles > represent larger +values while larger red circles represent larger -values)? >This was recently discussed on the list. See the thread that begins here: stat.ethz.ch/pipermail/r-help/2010-November/258453.html -- Statistics & Software Consulting GKX Group, GKX Associates Inc. tel: 1-877-GKX-GROUP email: ggrothendieck at gmail.com
This is a "tableplot", available on R-Forge at r-forge.r-project.org/projects/tableplot install.packages("tableplot", repos="R-Forge.R-project.org") will install, as long as you are using R 2.12.x; otherwise, you'll have to download the source package and install from source. -Michael On 11/5/2010 4:45 AM, fugelpitch wrote:> > I was just thinking of a way to present data and if it is possible in R. > > I have a data frame that looks as follows (this is just mockup data). > > df > location,"species1","species2","species3","species4","species5" > "loc1",0.44,0.28,0.37,-0.24,0.41 > "loc2",0.54,0.62,0.34,0.52,0.71 > "loc3",-0.33,0.75,-0.34,0.48,0.61 > > location is a factor while all the species are numerical vectors. > > I would like to present this as a table (or something that looks like a > table) but instead of the numbers I would like to present circles (pch = 19) > that increases in size with increasing number. Is it also possible to make > it change color if the value is negative. (E.g. larger blue circles > represent larger +values while larger red circles represent larger -values)? > > > Jonas
Apparently Analagous Threads
- Using perm.t.test() upon Matrix/Dataframe columns parted by factor instead of t.test()
- merging dataframes
- I cannot get species scores to plot with site scores in MDS when I use a distance matrix as input. Problems with NA's?
- data.frame transformation
- Function for translation of a list into a matrix as used by ordination?