Bars, rectangles with bases on x-axis
Usage
geom_bar(mapping = NULL, data = NULL, stat = "bin", position = "stack", ...)
Arguments
- mapping
- The aesthetic mapping, usually constructed with
aesoraes_string. Only needs to be set at the layer level if you are overriding the plot defaults. - data
- A layer specific dataset - only needed if you want to override the plot defaults.
- stat
- The statistical transformation to use on the data for this layer.
- position
- The position adjustment to use for overlappling points on this layer
- ...
- other arguments passed on to
layer. This can include aesthetics whose values you want to set, not map. Seelayerfor more details.
Description
The bar geom is used to produce 1d area plots: bar charts for categorical x, and histograms for continuous y. stat_bin explains the details of these summaries in more detail. In particular, you can use the weight aesthetic to create weighted histograms and barcharts where the height of the bar no longer represent a count of observations, but a sum over some other variable. See the examples for a practical example.
Details
The heights of the bars commonly represent one of two things: either a count of cases in each group, or the values in a column of the data frame. By default, geom_bar uses stat="bin". This makes the height of each bar equal to the number of cases in each group, and it is incompatible with mapping values to the y aesthetic. If you want the heights of the bars to represent values in the data, use stat="identity" and map a value to the y aesthetic.
By default, multiple x's occuring in the same place will be stacked a top one another by position_stack. If you want them to be dodged from side-to-side, see position_dodge. Finally, position_fill shows relative propotions at each x by stacking the bars and then stretching or squashing to the same height.
Sometimes, bar charts are used not as a distributional summary, but instead of a dotplot. Generally, it's preferable to use a dotplot (see geom_point) as it has a better data-ink ratio. However, if you do want to create this type of plot, you can set y to the value you have calculated, and use stat='identity'
A bar chart maps the height of the bar to a variable, and so the base of the bar must always been shown to produce a valid visual comparison. Naomi Robbins has a nice article on this topic. This is the reason it doesn't make sense to use a log-scaled y axis with a bar chart
Aesthetics
geom_bar understands the following aesthetics (required aesthetics are in bold):
xalphacolourfilllinetypesizeweight
Examples

























Bars, rectangles with bases on x-axis的更多相关文章
- Flot Reference flot参考文档
Consider a call to the plot function:下面是对绘图函数plot的调用: var plot = $.plot(placeholder, data, options) ...
- 谈谈Python中列表、元组和数组的区别和骚操作
一.列表(List) 1.列表的特点 列表是以方括号“[]”包围的数据集合,不同成员以“,”分隔.如 L = [1,2,3], 列表a有3个成员. 列表是可变的数据类型[可进行增删改查],列表中可以包 ...
- UVA 10574 - Counting Rectangles 计数
Given n points on the XY plane, count how many regular rectangles are formed. A rectangle is regular ...
- UVA - 10574 Counting Rectangles
Description Problem H Counting Rectangles Input: Standard Input Output:Standard Output Time Limit: 3 ...
- 应用Apache Axis进行Web Service开发
转自(http://tscjsj.blog.51cto.com/412451/84813) 一.概述 SOAP原意为Simple Object Access Protocol(简单对象访问协议),是一 ...
- 有理数的稠密性(The rational points are dense on the number axis.)
每一个实数都能用有理数去逼近到任意精确的程度,这就是有理数的稠密性.The rational points are dense on the number axis.
- 使用axis开发web service服务端
一.axis环境搭建 1.安装环境 JDK.Tomcat或Resin.eclipse等. 2.到 http://www.apache.org/dyn/closer.cgi/ws/axis/1_4下载A ...
- PeopleSoft Rich Text Boxes上定制Tool Bars
在使用PT8.50或在8.51时,你可能遇到过Rich-text编辑框.该插件使你能够格式化文本,添加颜色.链接.图片等等.下面是效果图: 如果页面中只有这么一个字段,该文本框就会有足够的空间来容 ...
- AXIS最佳实践
前言: Axis是apache一个开源的webservice服务,需要web容器进行发布.本节主要用于介绍使用Axis开发webservice,包括服务端的创建.webservice的部署.客户端的调 ...
随机推荐
- 整理mysql的28个知识点(转)
版权声明:本文为博主原创文章,未经博主允许不得转载. https://blog.csdn.net/weixin_39220472/article/details/80247011整理mysql28个知 ...
- 学习WCF笔记之二
一.学习文章http://www.cnblogs.com/iamlilinfeng/archive/2012/09/25/2700049.html 二.步骤 学习WFC,按照大神的文章一步步学习,不过 ...
- Concurrency Managed Workqueue(三)创建workqueue代码分析
一.前言 本文主要以__alloc_workqueue_key函数为主线,描述CMWQ中的创建一个workqueue实例的代码过程. 二.WQ_POWER_EFFICIENT的处理 __alloc_w ...
- 请教中文的OCR软件哪个最好?
对原件,有这几种:1,全中文(含标点,一些英文符号)2,中英文(英文较多,或英文占大多数)3,全英文(这个用finereader8.0) 針對1.2 紫光 超星阅读器自带的OCR组件 尚书七号搞定全中 ...
- GNU的strong symbol和weak symbol
首先,同样的原型的两个函数在连个不同的c文件中都有定义,把这两个c文件编译.连接在一起,也没有什么错误.原因就是因为,gcc中有一个strong symbol和weak symbol的概念.默认函数定 ...
- [k8s] kubelet单组件启动静态pod
kubelet单组件启动静态pod 无需k8s其他组件,单独下载kubelet的二进制,可以启动静态pod. 静态pod不受api管理,kubectl get po可以看到,但是kubectl del ...
- ZYSocket 4.2.3 SOCKET框架组 发布[NEW]
http://blog.csdn.net/luyikk/article/details/6099337
- Latex中文utf-8编码的三种方式
我们知道Latex一般用CJK和CTEX宏包支持中文编辑,CJK和CTEX的默认编码是GBK,而windows下的默然编码就是GBK,因此CJK和CTEX不需要特殊配置就可以直接支持中文Latex编译 ...
- github初使用
http://www.eoeandroid.com/thread-274556-1-1.html 其中编写 $ git remote add origin <a href="\&quo ...
- Untrusted 游戏 通关攻略
这个游戏还不错,用了两个晚上的时间通过并写下解法.这个游戏通过修改JS代码来通关的游戏.很考验玩家的解决问题能力,同时也有一定的可玩性. 游戏地址 http://alexnisnevich.githu ...