作者热门文章
- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
例如,我们有通常的堆叠条形图:
ggplot(diamonds, aes(x=color, fill=cut))+geom_bar(position="fill")
我想制作相同的情节,但只保留其中一种“剪切”类型。例如“理想”(紫色的)。因此,它应该类似于理想钻石在所有其他具有相同颜色的钻石中所占比例的直方图。我可以在 ggplot 中执行此操作吗?
最佳答案
如果预先汇总数据,就很简单了:
library("plyr")
idl <- ddply(diamonds, .(color), summarize,
idealpct = sum(cut=="Ideal")/length(cut))
ggplot(idl, aes(x=color, y=idealpct)) +
geom_bar()
关于r - ggplot2:每个 bin 中因子的单级分数的条形图,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/11579107/
假设我有一个如下所示的数据框: >>> df Year MPG VehicleType FuelType 0 2000 20.5 Car Gas 1 2009
我有一些 XML,它是一个单一级别的属性,我无法将其从 XML 移动到对象: You can add 15 clients with your current plan. 此 xml 表示为此
我有两个函数,比方说: getCustomers() - 获取客户列表getCustomerDetials() - 获取每个客户的详细信息 我运行getCustomers(),该函数在其内部运行get
我是一名优秀的程序员,十分优秀!