Colorblind-friendly color palettes and themes for publication-quality scientific figures using matplotlib and seaborn.
Project description
pypubfigs is a Python package for creating publication-ready figures with colorblind-friendly palettes and themes for matplotlib/seaborn.
If you found pypubfigs helpful, please cite: ggpubfigs: Colorblind-Friendly Color Palettes and ggplot2 Graphic System Extensions for Publication-Quality Scientific Figures. DOI: 10.1128/MRA.00871-21
Guide
Install
Quick Start
Color Palettes
Table of Hex Codes
Themes
FAQ
Change Log
Versioning
Acknowledgements
Install
pip install pypubfigs
Quick Start
These quick-start examples demonstrate theme and palette usage.
import seaborn as sns
import matplotlib.pyplot as plt
from pypubfigs import friendly_pal, theme_big_simple
# Apply theme and palette
theme_big_simple()
sns.set_palette(friendly_pal("ito_seven"))
# Plot
tips = sns.load_dataset("tips")
sns.barplot(x="day", y="total_bill", hue="sex", data=tips)
plt.show()
import matplotlib.pyplot as plt
from pypubfigs import friendly_pal, theme_big_grid
theme_big_grid()
palette = friendly_pal("bright_seven")
x = [1, 2, 3, 4]
y1 = [10, 20, 25, 30]
y2 = [30, 23, 15, 5]
plt.bar(x, y1, color=palette[0], label="Group 1")
plt.bar(x, y2, bottom=y1, color=palette[1], label="Group 2")
plt.legend()
plt.show()
Color Palettes
All palettes are colorblind-friendly.
from pypubfigs import friendly_pal
# Discrete
friendly_pal("contrast_three")
# Continuous
friendly_pal("contrast_three", n=50, type="continuous")
Table of Hex Codes
| Palettes | Colors used |
|---|---|
| bright_seven | #4477AA, #228833, #AA3377, #BBBBBB, #66CCEE, #CCBB44, #EE6677 |
| contrast_three | #004488, #BB5566, #DDAA33 |
| vibrant_seven | #0077BB, #EE7733, #33BBEE, #CC3311, #009988, #EE3377, #BBBBBB |
| muted_nine | #332288, #117733, #CC6677, #88CCEE, #999933, #882255, #44AA99, #DDCC77, #AA4499 |
| nickel_five | #648FFF, #FE6100, #785EF0, #FFB000, #DC267F |
| ito_seven | #0072B2, #D55E00, #009E73, #CC79A7, #56B4E9, #E69F00, #F0E442 |
| ibm_five | #648FFF, #785EF0, #DC267F, #FE6100, #FFB000 |
| wong_eight | #E69F00, #56B4E9, #009E73, #F0E442, #0072B2, #D55E00, #CC79A7, #000000 |
| tol_eight | #332288, #117733, #44AA99, #88CCEE, #DDCC77, #CC6677, #AA4499, #882255 |
| zesty_four | #F5793A, #A95AA1, #85C0F9, #0F2080 |
| retro_four | #601A4A, #EE442F, #63ACBE, #F9F4EC |
| tableau_ten | #4E79A7, #F28E2B, #E15759, #76B7B2, #59A14F, #EDC948, #B07AA1, #FF9DA7, #9C755F, #BAB0AC |
| glasbey_twelve | #0000FF, #FF0000, #00FF00, #000033, #FF00B6, #005300, #FFD300, #009FFF, #9A4D42, #00FFBE, #783FC1, #1F9698 |
| viridis_eight | #440154, #46337E, #365C8D, #277F8E, #1FA187, #4AC16D, #9FDA3A, #FDE725 |
| cividis_eight | #00204D, #16396D, #4B546C, #6C6E72, #8E8A79, #B3A772, #DBC761, #FFEA46 |
Themes
Publication-ready themes
theme_simple()theme_big_simple()theme_grid()theme_big_grid()theme_grey()
Presentation-ready themes
theme_black()theme_blue()theme_red()
import seaborn as sns
import matplotlib.pyplot as plt
from pypubfigs import friendly_pal, theme_black
theme_black()
sns.set_palette(friendly_pal("bright_seven"))
tips = sns.load_dataset("tips")
sns.scatterplot(data=tips, x="total_bill", y="tip", hue="day")
plt.title("Seaborn example with theme_black()")
plt.show()
FAQ
Can I submit color palettes or themes to be incorporated into pypubfigs?
Yes. Submissions are encouraged. Please reach out via Bluesky or contact information.
Change Log
1.1.3 (2026-02-24)
- Added new palettes:
tableau_ten,glasbey_twelve,viridis_eight, andcividis_eight. - Updated README palette table and usage examples.
- Added tests for palette and theme behavior.
1.1.2
- Strengthened theme/grid behavior consistency.
- Expanded automated tests.
1.1.1 and earlier
- Initial release series for Python parity with ggpubfigs themes and palettes.
Acknowledgements
- This package is the Python counterpart of ggpubfigs.
- Palette and theme design are based on the original ggpubfigs publication and implementation.
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file pypubfigs-1.1.3.tar.gz.
File metadata
- Download URL: pypubfigs-1.1.3.tar.gz
- Upload date:
- Size: 7.4 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.11.10
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
3ad2f3c6ead872a0bea780492d23901f49b9d760b49037b4353af918f2725896
|
|
| MD5 |
820b3bd43b1f7b10c64ee196a23c8781
|
|
| BLAKE2b-256 |
172c53c762863f6d0dd510fed53b32d9121b53755b1b98788e22311ea13ff1b6
|
File details
Details for the file pypubfigs-1.1.3-py2.py3-none-any.whl.
File metadata
- Download URL: pypubfigs-1.1.3-py2.py3-none-any.whl
- Upload date:
- Size: 6.7 kB
- Tags: Python 2, Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.11.10
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
7ab7453a3033052ecc14588e04c3609cb12c54f775cbe9d3a6032813eb3be661
|
|
| MD5 |
aa4cbf4538fcc0d78219edbea3e55305
|
|
| BLAKE2b-256 |
c06e1c0d5239c66bf3988a48c056a17e3dd4b41a6840c29865d8d6480ad01dac
|