我很难用ggplot包命名R中的箱子;我尝试使用names.args选项,但它没有用。
答案 0 :(得分:0)
使用ggplot标签创建数据框,然后在ggplot中创建条形图:
# my example uses some raster data
require(ggplot2)
require(raster)
r <- raster("myraster.tif")
f <- hist(r, breaks=10)
dat <- data.frame(counts= f$counts,breaks = f$mids)
ggplot(dat, aes(x = breaks, y = counts, fill =counts)) +
geom_bar(stat = "identity")+
scale_x_continuous(breaks = f$mids,labels = c("0 to 0.1","0.1 to 0.2","0.2 to 0.3","0.3 to 0.4","etc","etc","etc","etc","etc","etc"))