【发布时间】:2017-04-11 10:06:17
【问题描述】:
我正在努力用 ggplot 包命名 R 中的垃圾箱;我尝试使用 names.args 选项,但没有成功。
【问题讨论】:
我正在努力用 ggplot 包命名 R 中的垃圾箱;我尝试使用 names.args 选项,但没有成功。
【问题讨论】:
使用 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"))
【讨论】: