[R] table with values as dots in increasing sizes

ONKELINX, Thierry Thierry.ONKELINX at inbo.be
Fri Nov 5 10:10:16 CET 2010


> 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 op inbo.be
www.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 op r-project.org 
> [mailto:r-help-bounces op r-project.org] Namens fugelpitch
> Verzonden: vrijdag 5 november 2010 9:45
> Aan: r-help op 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: 
> http://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 op 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.
> 



More information about the R-help mailing list