https://github.com/avapolzin/albumpl

Custom matplotlib color palettes based on album covers.

https://github.com/avapolzin/albumpl

Science Score: 23.0%

This score indicates how likely this project is to be science-related based on various indicators:

  • CITATION.cff file
  • codemeta.json file
    Found codemeta.json file
  • .zenodo.json file
  • DOI references
  • Academic publication links
    Links to: arxiv.org, zenodo.org
  • Academic email domains
  • Institutional organization owner
  • JOSS paper metadata
  • Scientific vocabulary similarity
    Low similarity (10.2%) to scientific vocabulary

Keywords

color-cycle color-palette colormaps matplotlib palettes plotting python
Last synced: 6 months ago · JSON representation

Repository

Custom matplotlib color palettes based on album covers.

Basic Info
  • Host: GitHub
  • Owner: avapolzin
  • Language: Python
  • Default Branch: main
  • Homepage:
  • Size: 2.96 MB
Statistics
  • Stars: 14
  • Watchers: 1
  • Forks: 1
  • Open Issues: 0
  • Releases: 1
Topics
color-cycle color-palette colormaps matplotlib palettes plotting python
Created over 4 years ago · Last pushed 11 months ago
Metadata Files
Readme

README.md

albumpl_logo 001

Custom matplotlib color palettes based on album covers.

Documentation Status DOI Downloads

To install: ```bash cd ~

git clone git@github.com:avapolzin/albumpl.git

cd albumpl

sudo python3 setupy.py install

` or bash pip install albumpl ```

If you use this package or the scripts in this repository in a publication, please add a footnote linking to https://github.com/avapolzin/albumpl and/or consider adding this software to your acknowledgments. If you would like to cite albumpl, please use the Zenodo DOI linked here.

I'd love to feature plots/figures that make use of these palettes in the wild, so should these palettes be of use, please send me a copy of that figure and/or a link to your paper or presentation and I will share it here.

Each of the included palettes has been checked with COBLIS, and should be legible for individuals with most common forms of color blindness. Best, though, is to check your specific figures' readability, too.

(Interested in university-inspired palettes and colormaps? Check out rahrah.)

The palette options (to now) are: 1. LondonCalling inspired by The Clash - London Calling (which, of course, technically means it was inspired by Elvis Presley's eponymous album) LondonCalling_summary

  1. Antisocialites inspired by Alvvays - Antisocialites Antisocialites_summary

  2. RhumbLine inspired by Ra Ra Riot - The Rhumb Line RhumbLine_summary

  3. Matangi inspired by M.I.A. - Matangi Matangi_summary

  4. MellonCollie inspired by the Smashing Pumpkins - Mellon Collie and the Infinite Sadness MellonCollie_summary

  5. MellonCollie2012 inspired by the Smashing Pumpkins - Mellon Collie and the Infinite Sadness (2012 Deluxe Edition) MellonCollie2012_summary

  6. Yoshimi inspired by the Flaming Lips - Yoshimi Battles the Pink Robots Yoshimi_summary

  7. Figure8 inspired by Elliott Smith - Figure 8 Figure8_summary

  8. LiveThroughThis inspired by Hole - Live Through This LiveThroughThis_summary

  9. Post inspired by Björk - Post Post_summary

  10. VampireWeekend inspired by Vampire Weekend's self-titled debut VampireWeekend_summary

  11. CopperBlue inspired by Sugar - Copper Blue CopperBlue_summary

  12. Dreamland inspired by Glass Animals - Dreamland Dreamland_summary

  13. Garbage inspired by Garbage - Garbage Garbage_summary

  14. BlameItOnGravity inspired by Old 97's - Blame It On Gravity BlameItOnGravity_summary

  15. ChutesTooNarrow inspired by the Shins - Chutes Too Narrow ChutesTooNarrow_summary

There are also a handful of alternative colormaps included in albumpl, which are not the default colormap associated with a particular palette, but can be accessed individually in the same way as any other colormap.

These standalone colormaps (named for songs on the album that inspired them) are:

Additional palettes and colormaps will be added moving forward. Is there a specific album you want considered for a future palette? Please open an issue with the name of the album and artist and an image of the album cover.

About the sample images: For sequential colormaps, the sample image is photometric HST data of the dwarf galaxy COSMOS-dw1 in F814W. The sample image for diverging colormaps is an HI velocity map of the galaxy M33 from GALFA-HI.

And, though it should go without saying, I'll add: use of an artist's album cover to make a palette is not an endorsement of the artist or their (broadcast) personal views.


How to use albumpl:

Some quick recipes.

If you are using v0.2 or below, before doing anything you will need to register the new album-inspired colormaps. To do this: ```python from albumpl.cmap import register_all

registerall() `` This is necessary for any of thealbumpl.palettefunctions that use the colormaps, such assetdefaultandsetdefaultcmap`. This is not necessary for versions >0.3.

  • To list all palettes and their properties: ```python from albumpl.palette import list_palettes

list_palettes() `` *You can also filter for number of colors in the color cycle or type of colormap (sequential/diverging) with the argumentsmincolorsandmaptype`.*

  • To list all colormaps: ```python from albumpl.cmap import list_maps

list_maps() ```

  • To set palette as default for both color cycle and colormap: ```python from albumpl.palette import set_default

set_default('LondonCalling') ```

  • To set a palette as default for color cycle or colormap: ```python from albumpl.palette import setdefaultccyle, setdefaultcmap

setdefaultccyle('Antisocialites') *or* python setdefaultcmap('RhumbLine') ```

  • To access colormaps without setting them as default: You can access all of the colormaps using strings -- i.e., 'Matangi' or 'MellonCollie_r' for the reversed 'MellonCollie' map.

```python import matplotlib.pyplot as plt from albumpl.cmap import * #yes, this is bad practice, but easiest in this case!

register_all() #should only be run one time at the beginning of a script plt.imshow(image, cmap = 'Yoshimi') *or* if you are using version 0.2 or older you can access the colormaps via functions (offered as an option since it can be kind of nice for things like easily toggling whether a map is reversed or not) -- this is deprecated in v0.3 and above: python import matplotlib.pyplot as plt from albumpl.cmap import * #yes, this is bad practice, but easiest in this case!

plt.imshow(image, cmap = Yoshimi()) *To reverse the colormap, use the argument `reverse_cmap = True` or just feed the colormap the string "reverse" or "_r".* python plt.imshow(image, cmap = Figure8(reversecmap = True)) *or* python plt.imshow(image, cmap = LiveThroughThis('reverse')) *or* python plt.imshow(image, cmap = Post('r')) ```

  • To access the colors in a color cycle/palette without setting a default: ```python from albumpl.palette import return_colors

return_colors('VampireWeekend') ```


These palettes and colormaps are designed with a focus on remaining faithful to the appearance of the album covers instead of emphasizing perceptual uniformity. Most are still pretty good in this regard, but, just for everyone's peace of mind, following matplotlib, the lightness of each colormap as a function of index is shown below (all sequential maps are shown dark-to-light for easier comparison). Lightness


Papers that use albumpl:

Owner

  • Login: avapolzin
  • Kind: user
  • Company: The University of Chicago

GitHub Events

Total
  • Watch event: 2
  • Push event: 11
Last Year
  • Watch event: 2
  • Push event: 11

Packages

  • Total packages: 1
  • Total downloads:
    • pypi 110 last-month
  • Total dependent packages: 0
  • Total dependent repositories: 0
  • Total versions: 11
  • Total maintainers: 1
pypi.org: albumpl

Matplotlib color palettes based on album covers.

  • Versions: 11
  • Dependent Packages: 0
  • Dependent Repositories: 0
  • Downloads: 110 Last month
Rankings
Dependent packages count: 7.5%
Average: 38.6%
Dependent repos count: 69.8%
Maintainers (1)
Last synced: 6 months ago

Dependencies

setup.py pypi
  • matplotlib *