{"id":47306008,"url":"https://github.com/austinv11/pybuencolors","last_synced_at":"2026-03-17T08:03:39.380Z","repository":{"id":327995544,"uuid":"1112046866","full_name":"austinv11/PyBuenColors","owner":"austinv11","description":"A Pythonic port of the BuenColors R package","archived":false,"fork":false,"pushed_at":"2025-12-10T16:08:15.000Z","size":12670,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"master","last_synced_at":"2026-01-04T06:01:50.371Z","etag":null,"topics":["matplotlib","matplotlib-figures","matplotlib-style-sheets","matplotlib-styles"],"latest_commit_sha":null,"homepage":"https://austinv11.github.io/PyBuenColors","language":"Python","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/austinv11.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2025-12-08T04:32:21.000Z","updated_at":"2025-12-10T16:06:59.000Z","dependencies_parsed_at":null,"dependency_job_id":null,"html_url":"https://github.com/austinv11/PyBuenColors","commit_stats":null,"previous_names":["austinv11/pybuencolors"],"tags_count":2,"template":false,"template_full_name":null,"purl":"pkg:github/austinv11/PyBuenColors","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/austinv11%2FPyBuenColors","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/austinv11%2FPyBuenColors/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/austinv11%2FPyBuenColors/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/austinv11%2FPyBuenColors/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/austinv11","download_url":"https://codeload.github.com/austinv11/PyBuenColors/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/austinv11%2FPyBuenColors/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":30618088,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-03-17T04:46:40.957Z","status":"ssl_error","status_checked_at":"2026-03-17T04:46:32.538Z","response_time":56,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.5:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"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":["matplotlib","matplotlib-figures","matplotlib-style-sheets","matplotlib-styles"],"created_at":"2026-03-17T08:03:37.995Z","updated_at":"2026-03-17T08:03:39.375Z","avatar_url":"https://github.com/austinv11.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# PyBuenColors\n\n[![PyPI version](https://img.shields.io/pypi/v/buencolors.svg)](https://pypi.org/project/buencolors/)\n[![Build Status](https://img.shields.io/github/actions/workflow/status/austinv11/PyBuenColors/ci.yml?branch=master)](https://github.com/austinv11/PyBuenColors/actions)\n[![License](https://img.shields.io/github/license/austinv11/PyBuenColors.svg)](https://github.com/austinv11/PyBuenColors/blob/master/LICENSE)\n\nA pythonic port of the [BuenColors R package](https://github.com/caleblareau/BuenColors) for convenient scientific color palettes and matplotlib styles.\n\nColor palettes are a direct port from the R package, with many based on the [wesanderson](https://github.com/karthik/wesanderson) R package.\n\n## Installation\n\n```bash\npip install buencolors\n```\n\n## Quick Start\n\n### Using the Pretty Plot Style\n\nThe easiest way to improve your matplotlib plots is to use the included `pretty-plot` style:\n\n```python\nimport matplotlib.pyplot as plt\nimport numpy as np\n\n# Apply the pretty-plot style\nplt.style.use('pretty-plot')\n\n# Create a beautiful plot\nx = np.linspace(0, 10, 100)\nplt.plot(x, np.sin(x), label='sin(x)')\nplt.plot(x, np.cos(x), label='cos(x)')\nplt.xlabel('x')\nplt.ylabel('y')\nplt.legend()\nplt.show()\n```\n\n**Before (default):**\n\n![Default Style](https://raw.githubusercontent.com/austinv11/PyBuenColors/master/figures/default_style.png)\n\n**After (pretty-plot):**\n\n![Pretty Style](https://raw.githubusercontent.com/austinv11/PyBuenColors/master/figures/pretty_style.png)\n\n### Using Color Palettes\n\nBuenColors automatically registers all palettes as matplotlib colormaps:\n\n```python\nimport buencolors as bc\nimport matplotlib.pyplot as plt\nimport numpy as np\n\n# List available palettes\nbc.list_palettes()\n\n# Palettes are available directly as colormaps\nplt.style.use('pretty-plot')\ndata = np.random.randn(100, 100)\nplt.imshow(data, cmap='Zissou')\nplt.colorbar()\nplt.show()\n\n# Or use get_palette() to extract individual colors\ncolors = bc.get_palette('Zissou')\nfor i, color in enumerate(colors):\n    plt.plot([0, 1], [i, i], color=color, linewidth=10)\nplt.show()\n```\n\n## Features\n\n### Helper Functions\n\nBuenColors provides several utility functions to make your plots publication-ready:\n\n#### Eject Legend\n\nMove legends outside the plot area to avoid obscuring data:\n\n```python\nimport matplotlib as plt\nimport buencolors as bc\n\n# Your plot code here\nplt.plot(x, y1, label='Dataset 1')\nplt.plot(x, y2, label='Dataset 2')\n\n# Eject the legend to the right\nbc.eject_legend()\n```\n\n![Eject Legend Example](https://raw.githubusercontent.com/austinv11/PyBuenColors/master/figures/util_eject_legend.png)\n\n#### Rotate X-Tick Labels\n\nAutomatically rotate discrete x-tick labels for better readability:\n\n```python\nbc.rotate_discrete_xticks()\n```\n\n![Rotate XTicks Example](https://raw.githubusercontent.com/austinv11/PyBuenColors/master/figures/util_rotate_xticks.png)\n\n#### Grab Legend\n\nExtract a legend to a separate figure for independent saving or publication:\n\n```python\n# Create a plot with legend\nplt.plot(x, y1, label='Dataset 1')\nplt.plot(x, y2, label='Dataset 2')\nplt.legend()\n\n# Extract legend to separate figure (removes from original by default)\nlegend_fig = bc.grab_legend()\nlegend_fig.savefig('legend.pdf', bbox_inches='tight')\nplt.savefig('plot.pdf')  # Plot saved without legend\n\n# Or keep legend on original plot\nlegend_fig = bc.grab_legend(remove=False)\nlegend_fig.savefig('legend_copy.pdf', bbox_inches='tight')\nplt.show()  # Original plot still has legend\n```\n\n![Grab Legend Example](https://raw.githubusercontent.com/austinv11/PyBuenColors/master/figures/util_grab_legend.png)\n\n#### Color by Density\n\nColor scatter plot points by their density:\n\n```python\nx = np.random.randn(1000)\ny = np.random.randn(1000)\ndensity = bc.get_density(x, y)\n\nplt.scatter(x, y, c=density, cmap='viridis', s=5)\nplt.colorbar(label='Density')\n```\n\n![Density Example](https://raw.githubusercontent.com/austinv11/PyBuenColors/master/figures/util_density.png)\n\n#### Shuffle Plot Order\n\nRandomize the order of plot elements to avoid overplotting bias:\n\n```python\nx_shuffled, y_shuffled, colors_shuffled = bc.shuffle(x, y, colors)\nplt.scatter(x_shuffled, y_shuffled, c=colors_shuffled)\n```\n\n![Shuffle Example](https://raw.githubusercontent.com/austinv11/PyBuenColors/master/figures/util_shuffle.png)\n\n#### Number to Color\n\nMap numerical values to colors from a palette:\n\n```python\nvalues = [1, 2, 3, 4, 5]\ncolors = bc.number_to_color(values, palette='Zissou')\n```\n\n![Number to Color Example](https://raw.githubusercontent.com/austinv11/PyBuenColors/master/figures/util_number_to_color.png)\n\n## Single-Cell Analysis\n\nBuenColors provides specialized functions for single-cell analysis visualization, designed to work seamlessly with Scanpy and AnnData objects.\n\n### Installation for Single-Cell Features\n\nTo use the single-cell features, install with scanpy and anndata:\n\n```bash\npip install buencolors scanpy anndata\n```\n\n### Clean UMAP Visualization\n\nThe `clean_umap()` function creates publication-ready UMAP plots with minimal decorations:\n\n```python\nimport scanpy as sc\nimport buencolors as bc\nimport matplotlib.pyplot as plt\n\n# Load example dataset\nadata = sc.datasets.pbmc3k_processed()\n\n# Create a clean UMAP colored by cell type\nwith plt.style.context('pretty-plot'):\n    bc.clean_umap(adata, color='louvain', palette='lawhoops')\n```\n\nFeatures of `clean_umap()`:\n\n- **Minimal decorations**: No borders, ticks, or frame\n\n- **Custom L-shaped axis indicators**: Small arrows showing UMAP dimensions\n\n- **Auto-ejected legend**: Automatically positioned to the right to avoid obscuring data\n\n- **Shuffled cells**: Randomizes plotting order to avoid non-random ordering artifacts\n\n![Clean UMAP Example](https://raw.githubusercontent.com/austinv11/PyBuenColors/master/figures/single_cell_clean_umap.png)\n\n## Examples\n\nFor detailed examples and interactive notebooks, see the [documentation](https://austinv11.github.io/PyBuenColors/) or the [docs/examples directory](docs/examples/).\n\n## Available Palettes\n\n![All Palettes](https://raw.githubusercontent.com/austinv11/PyBuenColors/master/figures/all_palettes.png)\n\n## License\n\nThis project is licensed under the MIT License.\n\n## Credits\n\n- Original [BuenColors R package](https://github.com/caleblareau/BuenColors)\n- Wes Anderson palettes inspired by [wesanderson](https://github.com/karthik/wesanderson)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Faustinv11%2Fpybuencolors","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Faustinv11%2Fpybuencolors","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Faustinv11%2Fpybuencolors/lists"}