{"id":29932839,"url":"https://github.com/benjaminleroy/cowpatch","last_synced_at":"2025-08-02T18:10:42.002Z","repository":{"id":42376674,"uuid":"437399760","full_name":"benjaminleroy/cowpatch","owner":"benjaminleroy","description":"pythonic ggplot image combinations https://benjaminleroy.github.io/cowpatch","archived":false,"fork":false,"pushed_at":"2023-02-12T23:56:33.000Z","size":14473,"stargazers_count":10,"open_issues_count":5,"forks_count":2,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-07-18T03:50:19.158Z","etag":null,"topics":["graphics","plotting","python","svg"],"latest_commit_sha":null,"homepage":"","language":"Jupyter Notebook","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/benjaminleroy.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2021-12-11T22:14:20.000Z","updated_at":"2025-01-05T02:30:36.000Z","dependencies_parsed_at":"2023-02-15T19:15:54.915Z","dependency_job_id":null,"html_url":"https://github.com/benjaminleroy/cowpatch","commit_stats":null,"previous_names":[],"tags_count":2,"template":false,"template_full_name":null,"purl":"pkg:github/benjaminleroy/cowpatch","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/benjaminleroy%2Fcowpatch","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/benjaminleroy%2Fcowpatch/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/benjaminleroy%2Fcowpatch/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/benjaminleroy%2Fcowpatch/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/benjaminleroy","download_url":"https://codeload.github.com/benjaminleroy/cowpatch/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/benjaminleroy%2Fcowpatch/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":268431644,"owners_count":24249413,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-08-02T02:00:12.353Z","response_time":74,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["graphics","plotting","python","svg"],"created_at":"2025-08-02T18:10:40.038Z","updated_at":"2025-08-02T18:10:41.994Z","avatar_url":"https://github.com/benjaminleroy.png","language":"Jupyter Notebook","funding_links":[],"categories":[],"sub_categories":[],"readme":"# cowpatch\n\n\n[![test and codecov](https://github.com/benjaminleroy/cowpatch/actions/workflows/ci.yml/badge.svg)](https://github.com/benjaminleroy/cowpatch/actions/workflows/ci.yml)\n[![codecov](https://codecov.io/gh/benjaminleroy/cowpatch/branch/main/graph/badge.svg?token=QM5G5WV7AE)](https://codecov.io/gh/benjaminleroy/cowpatch)\n[![CodeFactor](https://www.codefactor.io/repository/github/benjaminleroy/cowpatch/badge)](https://www.codefactor.io/repository/github/benjaminleroy/cowpatch)\n\nA package for combining/aranging multiple python ggplot visuals from [`plotnine`](https://plotnine.readthedocs.io/en/stable/)\u003c!--, with allowances to also combined figures from [`matplotlib`](https://matplotlib.org/) and [`seaborn`](https://seaborn.pydata.org/)--\u003e. Internally, we leverage SVG objects and descriptions to accomplish it's goals.\n\n\u003c!--\n## Installation\n\nCurrently this project is under development and is not on\n[pypi](https://pypi.org/). As such, to install this package please do the\nfollowing:\n\n1. clone repository to your local computer (this assumes you have `git`\ninstalled):\n    ```bash\n    $ git clone https://github.com/benjaminleroy/cowpatch.git\n    ```\n2. install `poetry` if you don't have it already\n    ```bash\n    $ pip install poetry\n    ```\n3. then install the package (you need to be in the `cowpatch` root folder)\n    ```bash\n    $ poetry install\n    ```\n--\u003e\n\n## Installation\n\nTo install the current version of this package, please run\n\n```\npip install cowpatch\n```\n\nIf you would like to experiment with the development version of this package\nplease following the guidelines in the contributing page.\n\n## Usage\n\n```python\nimport cowpatch as cow\nimport plotnine as p9\nimport plotnine.data as p9_data\nimport numpy as np\n```\n\n```python\n# creation of some some ggplot objects\ng0 = p9.ggplot(p9_data.mpg) +\\\n    p9.geom_bar(p9.aes(x=\"hwy\")) +\\\n    p9.labs(title = 'Plot 0')\n\ng1 = p9.ggplot(p9_data.mpg) +\\\n    p9.geom_point(p9.aes(x=\"hwy\", y = \"displ\")) +\\\n    p9.labs(title = 'Plot 1')\n\ng2 = p9.ggplot(p9_data.mpg) +\\\n    p9.geom_point(p9.aes(x=\"hwy\", y = \"displ\", color=\"class\")) +\\\n    p9.labs(title = 'Plot 2')\n```\n\n```python\nvis_patch = cow.patch(g0,g1,g2)\nvis_patch += cow.layout(design = np.array([[0,1],\n                                           [0,2]]),\n                        rel_heights = [1,2])\nvis_patch.show(width = 11, height = 7)\n```\n\u003c!--\n```python\nvis_patch.save(width=11, height=7, filename=\"images/readme.svg\")\n```\n--\u003e\n![cowpatch example](images/readme.svg)\n\nPlease see additional documentation pages like \"Getting-Started\" and the\nindividual pages on different plot arrangement strategies.\n\n## Future Goals\n\nThis 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\n\n- [x] MVP #1: base implimentation (reflecting `cowplot` and `gridExtra` functionality, minus labeling and titles)\n- [ ] MVP #2: figure labeling and titles and `cow.text()` objects\n- [ ] MVP #3: \"Arithmetic of arrangement\" (reflecting `patchwork`)\n\nIn addition, we envision the following features coming along in parallel:\n\n- [ ] inseting plots (like seen in `cowplot`)\n- [ ] wrapping of `matplotlib`, `plotnine` and `seaborn` plots to work within the `cowpatch` framework and within the `patchwork` framework\n- [ ] more complex drawing tools like the `R` package `grid` to allow for easy creation of complex features\n\nFor the interested reader, a lot of these ideas have been sketched in our `notes/` folder as \"proof of concepts\".\n\n## Package Logistics\n\n### Background and history\n\nThis package's name is a merging of the names of `R` packages' `cowplot` and `patchwork`. It attempts to provide similar plot arrangement and combination tools as `gridExtra`, `cowplot` and `patchwork` for the `plotnine`'s `ggplot` objects.\n\nThis package is not directly related to any of aforementioned packages (including the [Wilke Lab](https://wilkelab.org/), lead by Claus O. Wilke) but naturally stands on the shoulders of the contributions each of the packages made.\n\nThis 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.\n\n\n### Contributing\n\nInterested 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.\n\n### License\n\n`cowpatch` was created by [Benjamin LeRoy](https://benjaminleroy.github.io/) ([benjaminleroy](https://github.com/benjaminleroy)) and Mallory Wang ([wangmallory](https://github.com/wangmallory)). It is licensed under the terms of the MIT license.\n\n### Credits\n\nThis `python` package stands on the shoulders of many open-source tools, `cowpatch` structure was created with [`cookiecutter`](https://cookiecutter.readthedocs.io/en/latest/) and the `py-pkgs-cookiecutter` [template](https://github.com/py-pkgs/py-pkgs-cookiecutter), the documentation leverages [`sphinx`](https://www.sphinx-doc.org/en/master/), and underlying testing leverages [`pytest`](https://docs.pytest.org/en/7.0.x/), [`hypothesis`](https://hypothesis.readthedocs.io/en/latest/) and [`pytest-regression`](https://pytest-regressions.readthedocs.io/en/latest/overview.html). See the full list of package dependencies on [Github](https://github.com/benjaminleroy/cowpatch/blob/main/pyproject.toml).\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbenjaminleroy%2Fcowpatch","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fbenjaminleroy%2Fcowpatch","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbenjaminleroy%2Fcowpatch/lists"}