全部版块 我的主页
论坛 数据科学与人工智能 数据分析与数据科学 R语言论坛
1729 4
2014-10-27
悬赏 50 个论坛币 已解决
复制代码
2014-10-27_102615.jpg   price

2014-10-27_102641.jpg carat


ggplot2 自带数据集diamonds,如何画出一模一样的图?谢谢!


最佳答案

firelife 查看完整内容

不知道要的是什么效果,稍微修改一下代码,类似这样吧 ggplot(diamonds,aes(x=price, fill=color)) + geom_histogram(aes(y=..density..),binwidth=250) + theme(legend.position="none") ggplot(diamonds,aes(x=carat,colour=color)) + geom_histogram(aes(y =..density..),binwidth=0.05,fill="black") + theme(legend.position = "none")
二维码

扫码加我 拉你入群

请注明:姓名-公司-职位

以便审核进群资格,未注明则拒绝

全部回复
2014-10-27 12:19:12
不知道要的是什么效果,稍微修改一下代码,类似这样吧

ggplot(diamonds,aes(x=price, fill=color)) +
  geom_histogram(aes(y=..density..),binwidth=250) +
  theme(legend.position="none")


ggplot(diamonds,aes(x=carat,colour=color)) +
  geom_histogram(aes(y =..density..),binwidth=0.05,fill="black") +
  theme(legend.position = "none")
二维码

扫码加我 拉你入群

请注明:姓名-公司-职位

以便审核进群资格,未注明则拒绝

2014-10-27 13:20:49
二维码

扫码加我 拉你入群

请注明:姓名-公司-职位

以便审核进群资格,未注明则拒绝

2014-10-28 07:54:33
firelife 发表于 2014-10-27 12:19
不知道要的是什么效果,稍微修改一下代码,类似这样吧

ggplot(diamonds,aes(x=price, fill=color)) +
第一个图如何旋转?谢谢!
二维码

扫码加我 拉你入群

请注明:姓名-公司-职位

以便审核进群资格,未注明则拒绝

2014-10-28 07:56:50
设置binwidth很重要
二维码

扫码加我 拉你入群

请注明:姓名-公司-职位

以便审核进群资格,未注明则拒绝

相关推荐
栏目导航
热门文章
推荐文章

说点什么

分享

扫码加好友,拉您进群
各岗位、行业、专业交流群