On Tue, 2007-11-20 at 00:37 +0000, Michal Charemza wrote: > Hi, > > Is there a way to plot non numerical data in R? > > Specifically, I have an array, say with 1000 entries, where each entry > is a string of 4 characters (in any order, 24 possibilities in my > case). I would like on the y-axis all the strings that are in the > array as labels. The x-axis I would like labeled 0 to 1000. The line > is to show how the strings change as we move through the array. > > (This is essentially a trace plot of a Markov Chain Monte Carlo > algorithm. I think essentially I would like an equivalent to > plot(myArray, type='l') but with discrete, finite, non-numerical > values on the y-axis) > > Is this possible? > > Michal.
For some pre-existing possibilities, you might want to look at the following CRAN packages: MCMCPack mcmc coda scapeMCMC Alternatively, consider coercing your character values to a factor, predicated upon some relevant ordering. You can then plot the numeric values of the factors for your y axis. Simple example: Y <- sample(LETTERS, 1000, replace = TRUE) plot(1:1000, factor(Y), type = "l", yaxt = "n") axis(2, at = 1:26, labels = LETTERS, cex.axis = 0.75) HTH, Marc Schwartz ______________________________________________ R-help@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.