cosmoplots-0.1.6
توضیحات
Routines to get a sane default configuration for production quality plots.
| ویژگی | مقدار |
|---|---|
| سیستم عامل | - |
| نام فایل | cosmoplots-0.1.6 |
| نام | cosmoplots |
| نسخه کتابخانه | 0.1.6 |
| نگهدارنده | [] |
| ایمیل نگهدارنده | [] |
| نویسنده | gregordecristoforo |
| ایمیل نویسنده | gregor.decristoforo@gmail.com |
| آدرس صفحه اصلی | https://github.com/uit-cosmo/cosmoplots |
| آدرس اینترنتی | https://pypi.org/project/cosmoplots/ |
| مجوز | MIT |
# cosmoplots
Routines to get a sane default configuration for production quality plots. Used by complex systems modelling group at UiT.
## Installation
The package is published to PyPI and can be installed with
```sh
pip install cosmoplots
```
If you want the development version you must first clone the repo to your local machine,
then install the project and its dependencies with [poetry]:
```sh
git clone https://github.com/uit-cosmo/cosmoplots.git
cd cosmoplots
poetry install
```
## Usage
Set your `rcparams` before plotting in your code, for example:
```Python
import cosmoplots
axes_size = cosmoplots.set_rcparams_dynamo(plt.rcParams, num_cols=1, ls="thin")
```
## `change_log_axis_base`
```python
import matplotlib.pyplot as plt
import numpy as np
import cosmoplots
axes_size = cosmoplots.set_rcparams_dynamo(plt.rcParams, num_cols=1, ls="thin")
a = np.exp(np.linspace(-3, 5, 100))
fig = plt.figure()
ax = fig.add_axes(axes_size)
ax.set_xlabel("X Axis")
ax.set_ylabel("Y Axis")
base = 2 # Default is 10, but 2 works equally well
cosmoplots.change_log_axis_base(ax, "x", base=base)
# Do plotting ...
# If you use "plot", the change_log_axis_base can be called at the top (along with add_axes
# etc.), but using loglog, semilogx, semilogy will re-set, and the change_log_axis_base
# function must be called again.
ax.plot(a)
plt.show()
```
## `matplotlib` vs. `cosmoplots` defaults
```python
import matplotlib.pyplot as plt
import numpy as np
import cosmoplots
# Matplotlib --------------------------------------------------------------------------- #
a = np.exp(np.linspace(-3, 5, 100))
fig = plt.figure()
ax = fig.add_subplot()
ax.set_xlabel("X Axis")
ax.set_ylabel("Y Axis")
ax.semilogy(a)
# plt.savefig("assets/matplotlib.png")
plt.show()
# Cosmoplots --------------------------------------------------------------------------- #
axes_size = cosmoplots.set_rcparams_dynamo(plt.rcParams, num_cols=1, ls="thin")
a = np.exp(np.linspace(-3, 5, 100))
fig = plt.figure()
ax = fig.add_axes(axes_size)
ax.set_xlabel("X Axis")
ax.set_ylabel("Y Axis")
cosmoplots.change_log_axis_base(ax, "y")
ax.semilogy(a)
# Commenting out the below line result in the default base10 ticks
cosmoplots.change_log_axis_base(ax, "y")
# plt.savefig("assets/cosmoplots.png")
plt.show()
```
| `matplotlib` | `cosmoplots` |
| :--------: | :--------: |
|  |  |
<!-- Links -->
[poetry]: https://python-poetry.org
نیازمندی
| مقدار | نام |
|---|---|
| >=3.3.2 | matplotlib |
| >=1.15.0 | numpy |
زبان مورد نیاز
| مقدار | نام |
|---|---|
| >=3.8 | Python |
نحوه نصب
نصب پکیج whl cosmoplots-0.1.6:
pip install cosmoplots-0.1.6.whl
نصب پکیج tar.gz cosmoplots-0.1.6:
pip install cosmoplots-0.1.6.tar.gz