You can subscribe to this list here.
| 2003 |
Jan
|
Feb
|
Mar
|
Apr
|
May
(3) |
Jun
|
Jul
|
Aug
(12) |
Sep
(12) |
Oct
(56) |
Nov
(65) |
Dec
(37) |
|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 2004 |
Jan
(59) |
Feb
(78) |
Mar
(153) |
Apr
(205) |
May
(184) |
Jun
(123) |
Jul
(171) |
Aug
(156) |
Sep
(190) |
Oct
(120) |
Nov
(154) |
Dec
(223) |
| 2005 |
Jan
(184) |
Feb
(267) |
Mar
(214) |
Apr
(286) |
May
(320) |
Jun
(299) |
Jul
(348) |
Aug
(283) |
Sep
(355) |
Oct
(293) |
Nov
(232) |
Dec
(203) |
| 2006 |
Jan
(352) |
Feb
(358) |
Mar
(403) |
Apr
(313) |
May
(165) |
Jun
(281) |
Jul
(316) |
Aug
(228) |
Sep
(279) |
Oct
(243) |
Nov
(315) |
Dec
(345) |
| 2007 |
Jan
(260) |
Feb
(323) |
Mar
(340) |
Apr
(319) |
May
(290) |
Jun
(296) |
Jul
(221) |
Aug
(292) |
Sep
(242) |
Oct
(248) |
Nov
(242) |
Dec
(332) |
| 2008 |
Jan
(312) |
Feb
(359) |
Mar
(454) |
Apr
(287) |
May
(340) |
Jun
(450) |
Jul
(403) |
Aug
(324) |
Sep
(349) |
Oct
(385) |
Nov
(363) |
Dec
(437) |
| 2009 |
Jan
(500) |
Feb
(301) |
Mar
(409) |
Apr
(486) |
May
(545) |
Jun
(391) |
Jul
(518) |
Aug
(497) |
Sep
(492) |
Oct
(429) |
Nov
(357) |
Dec
(310) |
| 2010 |
Jan
(371) |
Feb
(657) |
Mar
(519) |
Apr
(432) |
May
(312) |
Jun
(416) |
Jul
(477) |
Aug
(386) |
Sep
(419) |
Oct
(435) |
Nov
(320) |
Dec
(202) |
| 2011 |
Jan
(321) |
Feb
(413) |
Mar
(299) |
Apr
(215) |
May
(284) |
Jun
(203) |
Jul
(207) |
Aug
(314) |
Sep
(321) |
Oct
(259) |
Nov
(347) |
Dec
(209) |
| 2012 |
Jan
(322) |
Feb
(414) |
Mar
(377) |
Apr
(179) |
May
(173) |
Jun
(234) |
Jul
(295) |
Aug
(239) |
Sep
(276) |
Oct
(355) |
Nov
(144) |
Dec
(108) |
| 2013 |
Jan
(170) |
Feb
(89) |
Mar
(204) |
Apr
(133) |
May
(142) |
Jun
(89) |
Jul
(160) |
Aug
(180) |
Sep
(69) |
Oct
(136) |
Nov
(83) |
Dec
(32) |
| 2014 |
Jan
(71) |
Feb
(90) |
Mar
(161) |
Apr
(117) |
May
(78) |
Jun
(94) |
Jul
(60) |
Aug
(83) |
Sep
(102) |
Oct
(132) |
Nov
(154) |
Dec
(96) |
| 2015 |
Jan
(45) |
Feb
(138) |
Mar
(176) |
Apr
(132) |
May
(119) |
Jun
(124) |
Jul
(77) |
Aug
(31) |
Sep
(34) |
Oct
(22) |
Nov
(23) |
Dec
(9) |
| 2016 |
Jan
(26) |
Feb
(17) |
Mar
(10) |
Apr
(8) |
May
(4) |
Jun
(8) |
Jul
(6) |
Aug
(5) |
Sep
(9) |
Oct
(4) |
Nov
|
Dec
|
| 2017 |
Jan
(5) |
Feb
(7) |
Mar
(1) |
Apr
(5) |
May
|
Jun
(3) |
Jul
(6) |
Aug
(1) |
Sep
|
Oct
(2) |
Nov
(1) |
Dec
|
| 2018 |
Jan
|
Feb
|
Mar
|
Apr
(1) |
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
| 2020 |
Jan
|
Feb
|
Mar
|
Apr
|
May
(1) |
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
| 2025 |
Jan
(1) |
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
| S | M | T | W | T | F | S |
|---|---|---|---|---|---|---|
|
|
|
|
|
|
|
1
(1) |
|
2
|
3
(10) |
4
(17) |
5
(7) |
6
(21) |
7
(15) |
8
(6) |
|
9
(7) |
10
(8) |
11
(6) |
12
(11) |
13
(11) |
14
(13) |
15
(4) |
|
16
(5) |
17
(8) |
18
(8) |
19
(15) |
20
(3) |
21
(10) |
22
(5) |
|
23
(7) |
24
(8) |
25
(29) |
26
(26) |
27
(7) |
28
(2) |
29
(3) |
|
30
(3) |
|
|
|
|
|
|
|
From: Paul T. <pau...@gm...> - 2012-09-26 02:29:28
|
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) # ie, 32 + 22 + 15 + 5 + 2
the_cumsum = np.cumsum(defects) # 32, 32 + 22, 32 + 22 + 15, 32 + 22 + 15
+ 5, 32 + 22, + 15 + 5 + 2
percent = (np.divide(the_cumsum, the_sum)) * 100
ind = np.arange(len(defects)) # the x locations for the groups
width = .98 # with do of the bars, where a width of 1 indidcates no space
between bars
x = ind + .5 * width # find the middle of the bar
fig = plt.figure() # create a figure
ax1 = fig.add_subplot(111) # and a subplot
ax2 = ax1.twinx() # create a duplicate y axis
rects1 = ax1.bar(ind, defects, width=width) # draw the chart
line, = ax2.plot(x, percent) # draw the line
ax1.set_ylim(ymax=the_sum) # without these limits, graphs will not work
ax2.set_ylim(0, 100)
ax1.set_xticks(x) # set ticks for middle of bars
ax1.set_xticklabels(labels) # create the labels for the bars
ax1.set_ylabel('Defects') # create the left y axis label
ax2.set_ylabel('Percentage') # create the right y axis label
plt.show()
On Tue, Sep 25, 2012 at 2:31 PM, Jeffrey Melloy <jm...@gm...> wrote:
> ax1.set_ylim(0, sum(data))
> ax2.set_ylim(0, 100)
> seems to solve both of these issues.
>
> On Tue, Sep 25, 2012 at 11:16 AM, Paul Tremblay <pau...@gm...>
> wrote:
> > 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 middle of the bar. It needs to start on top, in
> > the middle.
> >
> > Maybe there is a way to correct 1 & 2 with your method, but I can't
> seem to
> > find it.
> >
> > Thanks!
> >
> > Paul
> >
> >
> > On Tue, Sep 25, 2012 at 12:58 PM, Jeffrey Melloy <jm...@gm...>
> wrote:
> >>
> >> 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", "#00004d",
> >> "#cc0052", "#591616", "#7d8060", "#299da6", "#9c8fbf",
> >> "#4c132a", "#8c3f23", "#85cc33", "#607980", "#7c30bf", "#bf9360",
> >> "#324d13", "#13394d", "#4c1659", "#b25f00", "#99cca7",
> >> "#669ccc", "#594358"]
> >>
> >> fig, ax1 = plt.subplots()
> >> ax2 = ax1.twinx()
> >>
> >> for i, d in enumerate(data):
> >> ax1.bar(i + .25, d, .5, zorder=0, alpha=0.5, label = labels[i],
> >> color=colors[i % len(colors)])
> >>
> >> percent = [d*1.0/sum(data) * 100 for d in np.cumsum(data)]
> >> ax2.plot(np.arange(len(data)) + 0.5, percent, linestyle='-',
> >> color='k', linewidth=2, zorder=5)
> >>
> >> ax1.set_xticks(np.arange(len(data)) + 0.5)
> >> ax1.set_xticklabels(labels, rotation=30, ha='right')
> >> #ax1.legend()
> >>
> >> ax1.set_ylabel('Defects')
> >> ax2.set_ylabel('Percentage')
> >> ax2.set_ylim(0,110)
> >>
> >> plt.show()
> >>
> >>
> >> On Mon, Sep 24, 2012 at 11:43 PM, Paul Hobson <pmh...@gm...>
> wrote:
> >> >> On Mon, Sep 24, 2012 at 12:21 AM, Paul Tremblay
> >> >> <pau...@gm...>
> >> >> 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 PM, Benjamin Root wrote:
> >> >> Your code looks overly complicated. You shouldn't have to be doing
> the
> >> >> connection to the ylim_changed event, I don't think. I think your
> main
> >> >> problem is that you are calling ax1.plot instead of ax2.plot.
> >> >>
> >> >> I am not against adding more examples to the gallery, but this would
> >> >> have to
> >> >> be cleaned up before it gets included.
> >> >>
> >> >> Ben Root
> >> >
> >> > On Mon, Sep 24, 2012 at 5:50 PM, Paul Tremblay <
> pau...@gm...>
> >> > wrote:
> >> >> 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.
> >> >
> >> > Paul,
> >> >
> >> > That example is an overly complicated template for making a pareto
> >> > chart.
> >> >
> >> > Here's how I'd do it:
> >> >
> >> > # data
> >> > defects = [0, 32, 22, 15, 5, 2]
> >> > labels = ['', 'vertical', 'horizontal', 'behind', 'left area',
> 'other']
> >> >
> >> > # axes
> >> > fig, ax1 = plt.subplots()
> >> > ax2 = ax1.twinx()
> >> >
> >> > # plotting
> >> > ax1.bar(np.arange(len(defects))-0.4, defects, zorder=0, alpha=0.5)
> >> > ax2.plot(np.cumsum(defects), linestyle='-', color='k', linewidth=2,
> >> > zorder=5)
> >> >
> >> > # formatting
> >> > ax1.set_xticks(np.arange(len(defects)))
> >> > ax1.set_xticklabels(labels)
> >> > ax1.set_ylabel('Defects')
> >> > ax2.set_ylabel('Percentage')
> >> > plt.show()
> >> >
> >> >
> >> >
> ------------------------------------------------------------------------------
> >> > Live Security Virtual Conference
> >> > Exclusive live event will cover all the ways today's security and
> >> > threat landscape has changed and how IT managers can respond.
> >> > Discussions
> >> > will include endpoint security, mobile security and the latest in
> >> > malware
> >> > threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
> >> > _______________________________________________
> >> > Matplotlib-users mailing list
> >> > Mat...@li...
> >> > https://lists.sourceforge.net/lists/listinfo/matplotlib-users
> >
> >
>
|