A package for combining/aranging multiple python ggplot visuals from
plotnine. Internally, we leverage SVG objects and descriptions to accomplish it’s goals.
To install the current version of this package, please run
pip install cowpatch
If you would like to experiment with the development version of this package please following the guidelines in the contributing page.
import cowpatch as cow import plotnine as p9 import plotnine.data as p9_data import numpy as np
# creation of some some ggplot objects g0 = p9.ggplot(p9_data.mpg) +\ p9.geom_bar(p9.aes(x="hwy")) +\ p9.labs(title = 'Plot 0') g1 = p9.ggplot(p9_data.mpg) +\ p9.geom_point(p9.aes(x="hwy", y = "displ")) +\ p9.labs(title = 'Plot 1') g2 = p9.ggplot(p9_data.mpg) +\ p9.geom_point(p9.aes(x="hwy", y = "displ", color="class")) +\ p9.labs(title = 'Plot 2')
vis_patch = cow.patch(g0,g1,g2) vis_patch += cow.layout(design = np.array([[0,1], [0,2]]), rel_heights = [1,2]) vis_patch.show(width = 11, height = 7)
Please see additional documentation pages like “Getting-Started” and the individual pages on different plot arrangement strategies.
This package is currently in development (please feel welcome to contribute, with code, examples, issues, publicity, etc.). We envision a sequence of versions coming out with different added features in each. The order of the features will look something like the following
[x] MVP #1: base implimentation (reflecting
gridExtrafunctionality, minus labeling and titles)
[ ] MVP #2: figure labeling and titles and
[ ] MVP #3: “Arithmetic of arrangement” (reflecting
In addition, we envision the following features coming along in parallel:
[ ] inseting plots (like seen in
[ ] wrapping of
seabornplots to work within the
cowpatchframework and within the
[ ] more complex drawing tools like the
gridto allow for easy creation of complex features
For the interested reader, a lot of these ideas have been sketched in our
notes/ folder as “proof of concepts”.
Background and history
This package’s name is a merging of the names of
patchwork. It attempts to provide similar plot arrangement and combination tools as
patchwork for the
This package is not directly related to any of aforementioned packages (including the Wilke Lab, lead by Claus O. Wilke) but naturally stands on the shoulders of the contributions each of the packages made.
This package leverages a SVG backend to create the arangements. This may make the actual package a bit more “hacky” then some may like, but we hope it can still be of use to the community.
Interested in contributing? Check out the contributing guidelines. Please note that this project is released with a Code of Conduct. By contributing to this project, you agree to abide by its terms.
python package stands on the shoulders of many open-source tools,
cowpatch structure was created with
cookiecutter and the
py-pkgs-cookiecutter template, the documentation leverages
sphinx, and underlying testing leverages
pytest-regression. See the full list of package dependencies on Github.