On Fri, Jun 15, 2012 at 9:22 PM, gianni lavaredo <gianni.lavar...@gmail.com> wrote: > Dear Researches, > > sorry for disturb. I wish to improve my figure in R plotting the relative > frequencies of my data set. > > library(lattice) > a <- c(0,0,0,1,1,2,4,5,6,7,7,7,7,7,8,8,8,8,9,9,9,9,10,10,11) > histogram(a, xlab="myData") > > what i wish to do is: > > 1) invert the order of X and Y (eg: Precent of Total on X-axis and "MyData" > on X-axis) > 2) plot not the bar of histogram but a line (i tried with > "lines(density(a))" but the result is not what i wish)
Take your pick: ta <- table(a) dotplot(ta, type = "h", lwd = 2, origin = 0) dotplot(100 * prop.table(ta), type = "h", lwd = 2, origin = 0, xlab = "Percent of total") xyplot(as.numeric(names(ta)) ~ 100 * prop.table(ta), type = "h", lwd = 2, origin = 0, horizontal = TRUE, xlab = "Percent of total", ylab = "myData", xlim = c(-1, NA)) -Deepayan ______________________________________________ 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.