Giter Site home page Giter Site logo

wafflemaker's Introduction

Wafflemaker

A python package to generate waffle plots. Originally inspired by this stack overflow question.

./tests/baseline/test_docs_household_debt.png

Related project: PyWaffle.

Code used to generate this example, based on examples from the R-based waffle library:

import pandas as pd
import wafflemaker

df = pd.DataFrame(dict(
    values=[84911, 14414, 10062, 8565],
    categories=[
        'Mortgage ($85k)',
        'Auto and tuition loans ($14k)',
        'Home equity loans ($10k)',
        'Credit cards ($9k)'
    ],
    hues=["#c7d4b6", "#a3aabd", "#a0d0de", "#97b5cf"]
))

df['scaled_values'] = df['values'] / 500.

wafflemaker.waffle(
    nrows=7,
    scale_to_dims=False,

    data=df,
    values='scaled_values',
    labels='categories',
    hue='hues',

    title='Average Household Debt',
    grid_options=dict(linewidth=2),
    figure_options=dict(figsize=(14, 5)),
)

For more examples, see the jupyter notebook.

Installation

To install the latest stable version, run this command in your terminal:

pip install -U wafflemaker

Development

To install the development version:

git clone https://github.com/shapiromatron/wafflemaker
cd wafflemaker
pip install -e .
pip install -e .[test]

To run tests:

cd wafflemaker
py.test

Image comparisons from matplotlib use the pytest-mpl library. To create new baseline images for comparison:

py.test --mpl-generate-path=tests/baseline

Please submit tests with new feature requests.

wafflemaker's People

Contributors

shapiromatron avatar

Watchers

 avatar  avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.