Skip to main content

A plotting package for the Brookings Institution

Project description

pyplotbrookings

Overview

pyplotbrookings is a matplotlib extension which implements the Brookings style guide. It offers several color palettes, a custom theme, and a few helper functions. pyplotbrookings is a python implementation of ggbrookings, an R extension for ggplot.

Installation

Currently pyplotbrookings now a python package, it can be downloaded with pip! The accepted alias for for pyplotbrookings is ppb. For example,

import pyplotbrookings as ppb

Usage

The pyplotbrookings package has a few simple user facing functions:

  • set_theme() overrides the default matplotlib theme for a custom one which adheres to the Brookings style guide.

  • set_palette() sets the matplotlib color cycler to one of several color palettes that are consistent with the Brookings brand and designed to provide color accessiblity.

  • add_title() adds titles and subtitles to a plot that are consistent with Brookings brand guidelines.

  • add_logo() adds a program/center logo to your plots after saving them.

  • get_camp() returns a continuous palette (or color map) using one of the color Brookings color palettes.

  • view_palette() helper function that previews a color palette showing both the order of palette and the appropriate text color that can be applied to each color.

  • import_roboto() imports and overrides the default matplotlib font (sans serif) to Roboto. Note, Roboto fonts come with this module so no additional font download is necessary.

  • figure() creates a matplotlib figure in one of the standard Brookings sizes.

  • save() saves a figure in the Brookings advised dpi values depending on content type.

Palette dictionaries (palettes and extended_palettes) for pyplotbrookings can also be used directly but only for lookup and not assignment.

Examples

Examples can be found in the attached Jupyter Notebook.

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

pyplotbrookings-0.0.4.tar.gz (2.8 MB view details)

Uploaded Source

Built Distribution

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

pyplotbrookings-0.0.4-py3-none-any.whl (2.0 MB view details)

Uploaded Python 3

File details

Details for the file pyplotbrookings-0.0.4.tar.gz.

File metadata

  • Download URL: pyplotbrookings-0.0.4.tar.gz
  • Upload date:
  • Size: 2.8 MB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.7.13

File hashes

Hashes for pyplotbrookings-0.0.4.tar.gz
Algorithm Hash digest
SHA256 4ad5a8e0b8b2ab881082e1dcadcb8e3b7e2ea5b315a5d175b904561c7f94935d
MD5 31c2b6f5e0f42ff2ee7e940719e413c7
BLAKE2b-256 7c2c4bb8b903d808cbd3eca90eca5224262f382d79d5cf58f0b9af73f7271e4f

See more details on using hashes here.

File details

Details for the file pyplotbrookings-0.0.4-py3-none-any.whl.

File metadata

File hashes

Hashes for pyplotbrookings-0.0.4-py3-none-any.whl
Algorithm Hash digest
SHA256 ffc2a654e1ca31b0889ec301dcc88af06576bbce7305e652af618b1e9912fc92
MD5 0d600819e1a05aa9ebd645534f5f3dca
BLAKE2b-256 1280dd41084c44b8adf06d5900d8019e4ff2d0e4d47e0d81f4414f21a85e65cb

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