R 如何在不使用包的情况下删除分层直方图的内边框
我正在编写一个函数来生成分层直方图。 这是我的密码。 我想删除内边框(因此这些堆栈计数仅按颜色分隔,而不是按颜色和边框分隔)。有什么想法吗R 如何在不使用包的情况下删除分层直方图的内边框,r,histogram,bar-chart,R,Histogram,Bar Chart,我正在编写一个函数来生成分层直方图。 这是我的密码。 我想删除内边框(因此这些堆栈计数仅按颜色分隔,而不是按颜色和边框分隔)。有什么想法吗 data("iris") strathist = function(x, y, ylab = "Frequency", xlab = "", main = ""){ cols = hcl(h=seq(0, 300, by = 50), fixup = FALSE) h = hist(x, breaks = 20, plot = F) tb
data("iris")
strathist = function(x, y, ylab = "Frequency", xlab = "", main = ""){
cols = hcl(h=seq(0, 300, by = 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"))
是否希望
barplot
中的border=NA
参数尝试了它,但它将删除所有边框。。。我不想要物种之间的内部边界