Giter Club home page Giter Club logo

paretochart's Introduction

paretochart

Pareto chart for python (similar to Matlab, but much more flexible).

Features

  • Data labels for the chart x-axis.
  • Fully customizable with unique arg and kwarg inputs:
  • Put the chart on arbitrary axes.

Examples

First, a simple import:

from paretochart import pareto

Now, let's create the numeric data (no pre-sorting necessary):

data = [21, 2, 10, 4, 16]

We can even assign x-axis labels (in the same order as the data):

labels = ['tom', 'betty', 'alyson', 'john', 'bob']

For this example, we'll create 4 plots that show the customization capabilities:

import matplotlib.pyplot as plt

# create a grid of subplots
fig, axes = plt.subplots(2, 2)

The first plot will be the simplest usage, with just the data:

pareto(data, axes=axes[0, 0])
plt.title('Basic chart without labels', fontsize=10)

In the second plot, we'll add labels, put a cumulative limit at 0.75 (or 75%) and turn the cumulative line green:

pareto(data, labels, axes=axes[0, 1], limit=0.75, line_args=('g',))
plt.title('Data with labels, green cum. line, limit=0.75', fontsize=10)

In the third plot, we'll remove the cumulative line and limit line, make the bars green and resize them to a width of 0.5:

pareto(data, labels, cumplot=False, axes=axes[1, 0], data_kw={'width': 0.5,
    'color': 'g'})
plt.title('Data without cum. line, green bar width=0.5', fontsize=10)

In the fourth plot, let's put the cumulative limit at 95% and make that line yellow:

pareto(data, labels, limit=0.95, axes=axes[1, 1], limit_kw={'color': 'y'})
plt.title('Data trimmed at 95%, yellow limit line', fontsize=10)

And last, but not least, let's show the image:

fig.canvas.set_window_title('Pareto Plot Test Figure')
plt.show()

This should result in the following image (click here if the image doesn't show up):

https://raw.github.com/tisimst/paretochart/master/pareto_plot_test_figure.png

Installation

Since this is really a single python file, you can simply go to the GitHub page, simply download paretochart.py and put it in a directory that python can find it.

Alternatively, the file can be installed using:

$ pip install --upgrade paretochart

or:

$ easy_install --upgrade paretochart

If you are using Python3, download the compressed file from here, unzip and run:

$ 2to3 -w *.py

while in the unzipped directory, then run:

$ python3 setup.py install

NOTE: Administrative privileges may be required to perform any of the above install methods.

Contact

Please send feature requests, bug reports, or feedback to Abraham Lee.

paretochart's People

Contributors

tisimst avatar

Watchers

Ricardo Gaya 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.