Skip to main content

Port of the R farrowandball palette implementation.

Project description

Farrow&Ball Matplotlib

This is a python port for the matplotlib library of the R Package for ggplot2.

Usage

The usage is quite simple:

from farrow_and_ball import *
import numpy as np
import matplotlib.pyplot as plt

# Define a gray scale image
x = np.arange(0, np.pi, 0.1)
y = np.arange(0, 2 * np.pi, 0.1)
X, Y = np.meshgrid(x, y)
Z = np.cos(X) * np.sin(Y) * 10

# Get the color map
cmap = build_colormap(DivergentPalette.DAY, True)

# Draw image
plt.imshow(Z, origin="lower", cmap=cmap)
plt.show()

One can also directly get the color map definition as a list of strings with farrow_and_ball.get_palette().

Palettes

The palettes are organized in Enums:

class SpectralPalette(Enum):
    DEEPSPEC = "deepspec"
    SPEC = "spec"
    LIGHTSPEC = "lightspec"
    LIGHTERSPEC = "lighterspec"


class DivergentPalette(Enum):
    DAY = "day"
    DAYLONG = "daylong"
    ARMY = "army"
    MONO = "mono"


class BaseColorPalette(Enum):
    PINKS = "pinks"
    PINKS_VAR = "pinks2"
    REDS = "reds"
    YELLOWS = "yellows"
    GREENS = "greens"
    GREENS_VAR = "greens2"
    BLUES = "blues"
    BLUES_VAR = "blues2"


class MiscPalette(Enum):
    TONKA = "tonka"
    BELLSPOUT = "bellsprout"
    DOCKERS = "dockers"
    FRUITYPEBBLES = "fruitypebbles"

One can also directly enter the name as a string, e.g. build_colormap("day", True).

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

farrow-and-ball-0.0.1.dev0.tar.gz (2.6 kB view details)

Uploaded Source

Built Distribution

farrow_and_ball-0.0.1.dev0-py3-none-any.whl (2.9 kB view details)

Uploaded Python 3

File details

Details for the file farrow-and-ball-0.0.1.dev0.tar.gz.

File metadata

  • Download URL: farrow-and-ball-0.0.1.dev0.tar.gz
  • Upload date:
  • Size: 2.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.1 importlib_metadata/4.6.0 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.61.1 CPython/3.7.7

File hashes

Hashes for farrow-and-ball-0.0.1.dev0.tar.gz
Algorithm Hash digest
SHA256 a168fc1857efc18550f814ca4b696f98fa780332076d4a1461d828ac90aec954
MD5 371af393fd601be33499106fe1967e12
BLAKE2b-256 c25a8ced866a84c11f1e8fecba254239eb1167d8167e33c7c1295d14e9bfe9fc

See more details on using hashes here.

File details

Details for the file farrow_and_ball-0.0.1.dev0-py3-none-any.whl.

File metadata

  • Download URL: farrow_and_ball-0.0.1.dev0-py3-none-any.whl
  • Upload date:
  • Size: 2.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.1 importlib_metadata/4.6.0 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.61.1 CPython/3.7.7

File hashes

Hashes for farrow_and_ball-0.0.1.dev0-py3-none-any.whl
Algorithm Hash digest
SHA256 963666240d6126e2cf7b6693f5df9aee261df66c426c3c19ed80bb0aabe27dc8
MD5 f18b0c747dd94766dd0d639affec4e35
BLAKE2b-256 2a706e534a37385975e1cb533049a8bc7db6d78046285ec53174967bc3ad7e31

See more details on using hashes here.

Supported by

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