Re: [Matplotlib-users] example of pareto chart

2012-09-27 Thread Paul Tremblay
On 9/26/12 12:31 PM, Benjamin Root wrote: On Wed, Sep 26, 2012 at 12:10 PM, Paul Tremblay paulhtremb...@gmail.com mailto:paulhtremb...@gmail.com wrote: Thanks. I know when doing 8/9 in python 2.x you get 0. With python 3 you get a decimal (Hooray, Python 3!). I ran the script I

Re: [Matplotlib-users] example of pareto chart

2012-09-26 Thread Pierre Haessig
Hi, Just a detail : Le 26/09/2012 04:29, Paul Tremblay a écrit : percent = (np.divide(the_cumsum, the_sum)) * 100 This lines doesn't work on my computer (numpy 1.6.2) Indeed, there is a casting issue : In [2]: percent Out[2]: array([ 0, 0, 0, 0, 100]) However, using the regular /

Re: [Matplotlib-users] example of pareto chart

2012-09-26 Thread Benjamin Root
On Wed, Sep 26, 2012 at 4:31 AM, Pierre Haessig pierre.haes...@crans.orgwrote: Hi, Just a detail : Le 26/09/2012 04:29, Paul Tremblay a écrit : percent = (np.divide(the_cumsum, the_sum)) * 100 This lines doesn't work on my computer (numpy 1.6.2) Indeed, there is a casting issue : In

Re: [Matplotlib-users] example of pareto chart

2012-09-26 Thread Pierre Haessig
Le 26/09/2012 15:25, Benjamin Root a écrit : Actually, if you are using the latest numpy (the 1.7 beta), that will also not work unless you are using py3k or did from __future__ import division. Well, actually, using np.divide will always result in integer division (this may or may not be a

Re: [Matplotlib-users] example of pareto chart

2012-09-26 Thread Paul Tremblay
Thanks. I know when doing 8/9 in python 2.x you get 0. With python 3 you get a decimal (Hooray, Python 3!). I ran the script I submitted with python 3. Do I need to change the defects and totals from integers to floats to make my chart work universally? P. On Wed, Sep 26, 2012 at 4:31 AM,

Re: [Matplotlib-users] example of pareto chart

2012-09-26 Thread Benjamin Root
On Wed, Sep 26, 2012 at 12:10 PM, Paul Tremblay paulhtremb...@gmail.comwrote: Thanks. I know when doing 8/9 in python 2.x you get 0. With python 3 you get a decimal (Hooray, Python 3!). I ran the script I submitted with python 3. Do I need to change the defects and totals from integers to

Re: [Matplotlib-users] example of pareto chart

2012-09-25 Thread Paul Hobson
On Mon, Sep 24, 2012 at 12:21 AM, Paul Tremblay paulhtremb...@gmail.com wrote: Here is my example of a Pareto chart. For an explanation of a Pareto chart: http://en.wikipedia.org/wiki/Pareto_chart Could I get this chart added to the matplolib gallery? Thanks Paul On 9/24/12 4:40

Re: [Matplotlib-users] example of pareto chart

2012-09-25 Thread Jeffrey Melloy
I think pareto charts are supposed to be percentages, not totals. data = [83, 38, 7, 5, 5, 4, 4, 2, 1] labels = [Vertical, Horizontal, Upper, Lower, Left, Right, Behind, Front, Down] colors = [#001499, #ff7f00, #9440ed, #edc240, #238c3f, #a60085, #00cca3, #464f8c, #005947, #4d,

Re: [Matplotlib-users] example of pareto chart

2012-09-25 Thread Paul Tremblay
There are two problems with this chart: 1. The scale is wrong. Imagine that you can stack all the bars on top of each other. When stacked, all the bars should fill in the graph exactly. In other words: ax1.set_ylim = sum(defects). See my original, or the wiki page. 2. The line starts in the

Re: [Matplotlib-users] example of pareto chart

2012-09-25 Thread Paul Tremblay
Yes, that works nice. So my final code, as minimalist as possible (while still maintaining readability): import matplotlib.pyplot as plt import numpy as np # the data to plot defects = [32, 22, 15, 5, 2] labels = ['vertical', 'horizontal', 'behind', 'left area', 'other'] the_sum = sum(defects) #

Re: [Matplotlib-users] example of pareto chart

2012-09-24 Thread Benjamin Root
On Mon, Sep 24, 2012 at 12:21 AM, Paul Tremblay paulhtremb...@gmail.comwrote: Here is my example of a Pareto chart. For an explanation of a Pareto chart: http://en.wikipedia.org/wiki/Pareto_chart Could I get this chart added to the matplolib gallery? Thanks Paul Your code looks

Re: [Matplotlib-users] example of pareto chart

2012-09-24 Thread Paul Tremblay
I took my example from the matplotlib pages itself: http://matplotlib.org/examples/api/fahrenheit_celcius_scales.html If you know a better way, please show me. P. On 9/24/12 4:40 PM, Benjamin Root wrote: On Mon, Sep 24, 2012 at 12:21 AM, Paul Tremblay paulhtremb...@gmail.com

Re: [Matplotlib-users] example of pareto chart

2012-09-24 Thread Paul Tremblay
By the way, I had done the chart differently to begin with. But this code requires more lines, more imports, and is more complex. (Without plt.gca().yaxis or the formatter, the graph will not come out.) import matplotlib.pyplot as plt import numpy as np from matplotlib.ticker import FuncFormatter

[Matplotlib-users] example of pareto chart

2012-09-23 Thread Paul Tremblay
Here is my example of a Pareto chart. For an explanation of a Pareto chart: http://en.wikipedia.org/wiki/Pareto_chart Could I get this chart added to the matplolib gallery? Thanks Paul import matplotlib.pyplot as plt import numpy as np def update_ax2(axx): ax2.set_ylim(0, 100)