Metadata-Version: 2.4
Name: pltsci
Version: 0.1.0
Summary: A utility library for matplotlib plotting configuration
Author: Muxkin
Author-email: Muxkin <muxkin@foxmail.com>
License: MIT License
        
        Copyright (c) 2025 Muxkin
        
        Permission is hereby granted, free of charge, to any person obtaining a copy
        of this software and associated documentation files (the "Software"), to deal
        in the Software without restriction, including without limitation the rights
        to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
        copies of the Software, and to permit persons to whom the Software is
        furnished to do so, subject to the following conditions:
        
        The above copyright notice and this permission notice shall be included in all
        copies or substantial portions of the Software.
        
        THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
        IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
        FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
        AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
        LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
        OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
        SOFTWARE.
        
Keywords: matplotlib,plotting,visualization
Classifier: Development Status :: 3 - Alpha
Classifier: Intended Audience :: Developers
Classifier: License :: OSI Approved :: MIT License
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.8
Classifier: Programming Language :: Python :: 3.9
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Topic :: Scientific/Engineering :: Visualization
Requires-Python: >=3.8
Description-Content-Type: text/markdown
License-File: LICENSE
Requires-Dist: matplotlib>=3.5.0
Requires-Dist: numpy>=1.20.0
Dynamic: author
Dynamic: license-file
Dynamic: requires-python

# PltSci

一个用于简化 matplotlib 绘图参数设置的 Python 工具库。

## 特性

- 🎨 快速设置科学绘图风格（Times New Roman 字体，内向刻度线等）
- 📏 厘米到英寸的便捷转换工具
- 🎯 简洁的坐标轴范围和刻度设置接口
- ✨ 适用于学术论文和科学报告的图表制作

## 安装

```bash
pip install pltsci
```

## 快速开始

```python
from pltsci import whole_plot_set, set_ticks, half_plot_set, cm
import matplotlib.pyplot as plt
import numpy as np

# 设置全局绘图参数
whole_plot_set()

# 创建示例数据
x = np.linspace(0, 10, 100)
y = np.sin(x)

# 创建图形 (使用厘米单位)
fig, ax = plt.subplots(figsize=(cm(12), cm(8)))
ax.plot(x, y, label='sin(x)')

# 设置坐标轴范围和刻度
set_ticks(ax, xrange=(0, 10, 2), yrange=(-1, 1, 0.5))

# 应用精细的轴样式
half_plot_set(ax)

# 添加标签和图例
ax.set_xlabel('x')
ax.set_ylabel('y') 
ax.legend()

plt.tight_layout()
plt.show()
```

## API 参考

### `whole_plot_set(font=None, math_font="stix")`
设置全局绘图参数，包括字体、刻度方向、图例样式等。

- `font`: 字体列表，默认为 `["Times New Roman", "SimSun"]`
- `math_font`: 数学公式字体，默认为 `"stix"`

### `set_ticks(ax, xrange=None, yrange=None)`
设置坐标轴范围和刻度。

- `ax`: matplotlib 轴对象
- `xrange`: x轴范围，格式为 `(xmin, xmax, xstep)`
- `yrange`: y轴范围，格式为 `(ymin, ymax, ystep)`

### `half_plot_set(ax)`
设置坐标轴线宽和刻度样式，适用于密集布局的图表。

- `ax`: matplotlib 轴对象

### `cm` / `cm_to_inch`
厘米到英寸转换工具。

```python
# 两种使用方式
fig, ax = plt.subplots(figsize=(cm(12), cm(8)))
# 或者
fig, ax = plt.subplots(figsize=(cm_to_inch(12), cm_to_inch(8)))
```

## 许可证

MIT License - 详见 [LICENSE](LICENSE) 文件。

## 贡献

欢迎提交 Issue 和 Pull Request！
