# \[그래프] 막대그래프 그리기

### 코드

```
@그래프 (데이터) "가로축"별 "세로축"으로 막대그래프 그리기
```

***

### 설명

가로축과 세로축을 지정해서 막대그래프를 그릴 때 사용해요.

***

### 주의사항

* 가로축/세로축은 실제 속성과 이름이 동일해야 해요.
* 세로축의 값은 숫자형이어야 해요.

***

### 파이썬 대응 코드

```
import matplotlib.pyplot as plt
plt.bar(df[label_key], df[value_key])
plt.show()
```

***

### 예시

{% code title="예시 코드" %}

```
인구데이터 = @데이터 "2026년 3월 행정구역별 인구수" 불러오기
@그래프 인구데이터 "행정구역"별 "인구"로 막대그래프 그리기
```

{% endcode %}

{% code title="예시 코드의 결과" %}

```
(행정구역별 인구수를 보여주는 막대그래프가 표시돼요.)
```

{% endcode %}

***

### 검색 키워드

막대그래프


---

# 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://codebook.horang.it/data/undefined-3.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.
