r - How to remove inside border for a stratified histogram without using package -
i writing function generate stratified histogram. here code. remove inside border (so stack counts separated colour only, not colour , border). ideas?
data("iris") strathist = function(x, y, ylab = "frequency", xlab = "", main = ""){ cols = hcl(h=seq(0, 300, = 50), fixup = false) h = hist(x, breaks = 20, plot = f) tb = table(y, cut(x, h$breaks)) par(mar = rep(4, 4)) plot.new() barplot(tb, space = 0, ylim = c(-0.4, 2 + max(h$count)), col = cols, ylab = ylab, xlab = xlab, main = main, axisnames = f) axis(1, 0:(length(h$breaks)-1), h$breaks) box() legend("topright", c(rownames(tb)), cex = 0.8, fill = cols) } with(iris, strathist(sepal.length, species, xlab = "sepal.length", main = "stratified histogram of iris species"))
Comments
Post a Comment