Skip to main content

Style plots with Pokemon colors

Project description

Palletetown is a python library that makes it easy to style matplotlib plots using a color palettes based on pokemon.

You can use palletetown to:

  • set global matplotlib settings based on a pokemon,
  • set a colormap for a pokemon,
  • set a color cycler for a pokemon,
  • draw a pokemon sprite,
  • get RGB color values from the sprite.

The easiest way to get started with palettetown is the set_rc command:

import palletetown.pokeplot as pkp

pkp.set_rc('pikachu')

This will set the colors of your plot to match the colors of the pokemon. It workes by setting the prop_cycle and cmap matplotlib rc parameters.

Check out the examples.ipynb jupyter notebook for usage examples.

Sample image

The pokeplot module handles high-level user interactions. Check out the jupyter notebook on our homepage for examples, or try these pokeplot features with your own plots.

import matplotlib.pyplot as plt
import numpy as np
import palletetown.pokeplot as pkp

# Get a colormap with colors set based on the pokemon sprite
cmap = pkp.get_cmap('pikachu')

# Use it with whatever plot you are working on.
data = np.random.random((10,10))
plt.imshow(data, cmap=cmap)

# Draw a pikachu sprite in the top right corner.
pkp.draw_sprite()

plt.show()

# The default colormap can be set.
pkp.set_rc('pikachu')

Pokemon and Pokedex objects can be manipulated directly for advanced use cases. A Pokemon object contains color data related to that pokemon. Pokedex objects are dictionary-like containers for Pokemon objects.

pikachu = pkp.get_pokemon('pikachu')
# matplotlib linear segmented colormap
cmap = pikachu.cmap
# color cycler
cycler = pikachu.cycler
# image of the pokemon as an ndarray
sprite = pikachu.sprite
# list of rgb colors as 8 bit integers
colors_int = pikachu.rgb_int
# list of rgb colors as floats normalized from 0. to 1.
colors_float = pikachu.rgb_float
# list of rgb colors as hex strings
colors_hex = pikachu.rgb_hex

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

palettetown-1.0.3.tar.gz (449.0 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

palettetown-1.0.3-py3-none-any.whl (703.5 kB view details)

Uploaded Python 3

File details

Details for the file palettetown-1.0.3.tar.gz.

File metadata

  • Download URL: palettetown-1.0.3.tar.gz
  • Upload date:
  • Size: 449.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.1 CPython/3.10.0

File hashes

Hashes for palettetown-1.0.3.tar.gz
Algorithm Hash digest
SHA256 4f65e019c952783e9d3437dba512ecb3727e5d68063d28a0984cea4c27c1530d
MD5 e3a7be9b9a30527fdfca53ec21c4da5d
BLAKE2b-256 8613f2e11954a00b733cf25dda2e7741d20f02d12ca8e37c470504ef77b4c76b

See more details on using hashes here.

File details

Details for the file palettetown-1.0.3-py3-none-any.whl.

File metadata

  • Download URL: palettetown-1.0.3-py3-none-any.whl
  • Upload date:
  • Size: 703.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.1 CPython/3.10.0

File hashes

Hashes for palettetown-1.0.3-py3-none-any.whl
Algorithm Hash digest
SHA256 c851b94830e9cb792e59c0ae41468bc6667ecf335f669ebcff66d3720024df65
MD5 5f29acc78d4671e6df57ac55336f4686
BLAKE2b-256 7eda37e498dd52fde33b69da13cba2b894010996306a97ddb257330b3620b2c4

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page