https://github.com/bbcho/quilter-dev
https://github.com/bbcho/quilter-dev
Last synced: over 1 year ago
JSON representation
- Host: GitHub
- URL: https://github.com/bbcho/quilter-dev
- Owner: bbcho
- License: mit
- Created: 2020-11-10T23:36:06.000Z (over 5 years ago)
- Default Branch: main
- Last Pushed: 2021-02-16T00:23:24.000Z (over 5 years ago)
- Last Synced: 2025-02-11T23:49:36.110Z (over 1 year ago)
- Language: Jupyter Notebook
- Size: 980 KB
- Stars: 8
- Watchers: 1
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Quilter
## The composer of Matplotlib plots. Python implementation of the R package patchwork.
This package overloads/creates operators for the matplotlib Figure class so that you can add and divide figures together into a new figure with subplots.
Adding two figures together creates a new figure with the original figures side-by-side as subplots. Dividing will stack the figured on top of each other.
Currently the package converts the input figures to images before reloading the images into the axes objects of the output figure. If anyone has a better way to copy actual axes objects to a new figure I'd loved help.
Here are some examples:
```
import matplotlib.pyplot as plt
import quilter # best to put this after your matplotlib import
fig1, ax1 = plt.subplots(figsize=(5,3))
ax1.plot([1, 2], label='my leg')
ax1.set_title("test")
ax1.legend()
fig2, ax2 = plt.subplots(figsize=(5,3))
ax2.plot([2, 2])
ax2.set_title("test 2")
```
Adding figures together
```
out = fig1 + fig2
```
Dividing figures
```
out = fig1 / fig2
```
More complex examples
```
out = (fig1 + fig2) / fig2
out = (fig1 + fig2) / (fig1 + fig2)
```