An open API service indexing awesome lists of open source software.

https://github.com/shenxiangzhuang/zhplot

一行代码搞定 Python 图表中文展示
https://github.com/shenxiangzhuang/zhplot

chinese data-visualization matplotlib plot python python3 wordcloud

Last synced: 6 months ago
JSON representation

一行代码搞定 Python 图表中文展示

Awesome Lists containing this project

README

          

# Zh-Plot: 一行代码搞定 Python 图表中文展示

[![Python](https://img.shields.io/pypi/pyversions/zhplot.svg?color=%2334D058)](https://pypi.org/project/zhplot/)
[![PyPI](https://img.shields.io/pypi/v/zhplot?color=%2334D058&label=pypi%20package)](https://pypi.org/project/zhplot/)
[![PyPI Downloads](https://static.pepy.tech/badge/zhplot)](https://pepy.tech/projects/zhplot)

[![Code style: black](https://img.shields.io/badge/code%20style-black-000000.svg)](https://github.com/psf/black)
[![Ruff](https://img.shields.io/endpoint?url=https://raw.githubusercontent.com/astral-sh/ruff/main/assets/badge/v2.json)](https://github.com/astral-sh/ruff)
[![Imports: isort](https://img.shields.io/badge/%20imports-isort-%231674b1?style=flat&labelColor=ef8336)](https://pycqa.github.io/isort/)
[![Checked with mypy](https://www.mypy-lang.org/static/mypy_badge.svg)](https://mypy-lang.org/)
[![pre-commit](https://img.shields.io/badge/pre--commit-enabled-brightgreen?logo=pre-commit)](https://github.com/pre-commit/pre-commit)

[![Build Docs](https://github.com/shenxiangzhuang/zhplot/actions/workflows/build_docs.yaml/badge.svg)](https://github.com/shenxiangzhuang/zhplot/actions/workflows/build_docs.yaml)
[![Test](https://github.com/shenxiangzhuang/zhplot/actions/workflows/test.yaml/badge.svg)](https://github.com/shenxiangzhuang/zhplot/actions/workflows/test.yaml)
[![Codecov](https://codecov.io/gh/shenxiangzhuang/zhplot/branch/master/graph/badge.svg)](https://codecov.io/gh/shenxiangzhuang/zhplot)
[![GitHub License](https://img.shields.io/github/license/shenxiangzhuang/zhplot)](https://github.com/shenxiangzhuang/zhplot/blob/master/LICENSE)

## 支持的框架
- [x] [matplotlib](https://github.com/matplotlib/matplotlib)
- [x] [wordcloud](https://github.com/amueller/word_cloud)

## 快速开始

### 安装

使用 [pip](https://pip.pypa.io/) 安装`zhplot`:

```bash
pip install zhplot
```

使用 [uv](https://docs.astral.sh/uv/) 安装`zhplot`:

```bash
uv add zhplot
```

### 使用方法

使用`zhplot`非常简单,只需在脚本开头导入即可:
```diff
+ import zhplot
import matplotlib.pyplot as plt
```

在汉化 wordcloud 的时候`import zhplot`需要在前面:
```diff
+ import zhplot
import wordcloud
```

### 一个简单的例子



```python
import zhplot
import matplotlib.pyplot as plt

plt.plot([1, 2, 3, 4])
plt.title('这是一个标题')
plt.xlabel('横坐标')
plt.ylabel('纵坐标')
plt.show()
```

## 相似项目
- [japanize-matplotlib](https://github.com/uehara1414/japanize-matplotlib)
- [chineseize-matplotlib](https://github.com/cndeng/chineseize-matplotlib)