# 直方图

## 分组直方图

```r
## 改变剪切事件因子顺序
data$V2=factor(data$V2,levels = c("IR","AA","AD","ES","AP"))
## 改变基因组因子顺序
data$V1=factor(data$V1,levels = c("D5","A2","Dt","At"))

ggplot(data=data,aes(x=data$V1,y=data$V3,fill=data$V2))+geom_bar(stat = "identity",position="dodge")
""
```

### 改变柱子的宽度

`geom_bar(stat = "identity",width = 0.5)`

### 改变组内柱子间隔

`geom_bar(stat = "identity",width = 0.5,position=position_dodge(0.8))`

使用`position=position_dodge(0.8)`参数

## 密度直方图

y轴为对应的概率密度，而不是计数

```r
```

## 频数直方图

## 旋转坐标轴

```bash
coord_flip()
```

## 参考

<http://www.sohu.com/a/119501701_464826>


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://zpliu.gitbook.io/booknote/ggplot2/zhi-fang-tu.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
