Peng Cai wrote:
Hi R Users, I'm trying to plot a stacked barplot. Here is data: Sample Col1 Col2 Col3 Row1 -2 4 -1 Row2 3 -2 4 Row3 3 5 -2 Row4 4 1 -1 I'm using following R code: library(lattice) dta<-read.table("data.txt", header=TRUE, row.names="Sample") barchart(data.matrix(dta), horizontal=FALSE, stack=TRUE, col=2:4, auto.key=list(space="right", title=names(dimnames(dta))[2]) ) Above code is working fine, but I need help with: 1) Legend boxes have default colors, whereas I'm looking them to match with barplot colors (col=2:4).
replace the line col = 2:4, with par.settings = simpleTheme(col = 2:4),
2) Can I increase scale for y axis, like currently it plotting -2,0,2,4,... I would like it as -2,-1,0,1,...
add the line scales = list(y = list(at = -2:8)), or whatever tick locations you prefer. -Peter Ehlers
Any help would be greatly appreciated, Thanks, Peng [[alternative HTML version deleted]] ______________________________________________ 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.
______________________________________________ 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.