SourceForge logo
SourceForge logo
Menu

matplotlib-checkins — Commit notification. DO NOT POST to this list, just subscribe to it.

You can subscribe to this list here.

2007 Jan
Feb
Mar
Apr
May
Jun
Jul
(115)
Aug
(120)
Sep
(137)
Oct
(170)
Nov
(461)
Dec
(263)
2008 Jan
(120)
Feb
(74)
Mar
(35)
Apr
(74)
May
(245)
Jun
(356)
Jul
(240)
Aug
(115)
Sep
(78)
Oct
(225)
Nov
(98)
Dec
(271)
2009 Jan
(132)
Feb
(84)
Mar
(74)
Apr
(56)
May
(90)
Jun
(79)
Jul
(83)
Aug
(296)
Sep
(214)
Oct
(76)
Nov
(82)
Dec
(66)
2010 Jan
(46)
Feb
(58)
Mar
(51)
Apr
(77)
May
(58)
Jun
(126)
Jul
(128)
Aug
(64)
Sep
(50)
Oct
(44)
Nov
(48)
Dec
(54)
2011 Jan
(68)
Feb
(52)
Mar
Apr
May
Jun
Jul
Aug
Sep
Oct
Nov
Dec
(1)
2018 Jan
Feb
Mar
Apr
May
(1)
Jun
Jul
Aug
Sep
Oct
Nov
Dec
S M T W T F S




1
(2)
2
(2)
3
(2)
4
5
(2)
6
(4)
7
8
9
10
11
12
13
(1)
14
(2)
15
(3)
16
(7)
17
(1)
18
(1)
19
(3)
20
(16)
21
(3)
22
(4)
23
(2)
24
25
26
(6)
27
(3)
28
(9)
29
(2)
30
(2)

Showing 2 results of 2

From: <ef...@us...> - 2010年04月03日 23:22:55
Revision: 8220
 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=8220&view=rev
Author: efiring
Date: 2010年04月03日 23:22:48 +0000 (2010年4月03日)
Log Message:
-----------
Update docs, examples, for new color kwarg in hist.
Modified Paths:
--------------
 trunk/matplotlib/CHANGELOG
 trunk/matplotlib/doc/api/api_changes.rst
 trunk/matplotlib/examples/pylab_examples/histogram_demo_extended.py
Modified: trunk/matplotlib/CHANGELOG
===================================================================
--- trunk/matplotlib/CHANGELOG	2010年04月03日 07:18:18 UTC (rev 8219)
+++ trunk/matplotlib/CHANGELOG	2010年04月03日 23:22:48 UTC (rev 8220)
@@ -1,7 +1,10 @@
-2010年03月24日 refactor colorbar code so that no cla() is necessary when 
+2010年04月03日 Added color kwarg to Axes.hist(), based on work by
+ Jeff Klukas. - EF
+
+2010年03月24日 refactor colorbar code so that no cla() is necessary when
 mappable is changed. -JJL
 
-2010年03月22日 fix incorrect rubber band during the zoom mode when mouse 
+2010年03月22日 fix incorrect rubber band during the zoom mode when mouse
 leaves the axes. -JJL
 
 2010年03月21日 x/y key during the zoom mode only changes the x/y limits. -JJL
Modified: trunk/matplotlib/doc/api/api_changes.rst
===================================================================
--- trunk/matplotlib/doc/api/api_changes.rst	2010年04月03日 07:18:18 UTC (rev 8219)
+++ trunk/matplotlib/doc/api/api_changes.rst	2010年04月03日 23:22:48 UTC (rev 8220)
@@ -10,6 +10,9 @@
 Changes beyond 0.99.x
 =====================
 
+* The :meth:`matplotlib.axes.Axes.hist` *color* kwarg now accepts
+ a sequence of color specs to match a sequence of datasets.
+
 * The :class:'~matplotlib.collections.EllipseCollection' has been
 changed in two ways:
 
@@ -19,7 +22,7 @@
 
 + The *height* and *width* kwargs have been changed to specify
 the height and width, again for consistency with
- :class:'~matplotlib.patches.Ellipse`, and to better match
+ :class:`~matplotlib.patches.Ellipse`, and to better match
 their names; previously they specified the half-height and
 half-width.
 
Modified: trunk/matplotlib/examples/pylab_examples/histogram_demo_extended.py
===================================================================
--- trunk/matplotlib/examples/pylab_examples/histogram_demo_extended.py	2010年04月03日 07:18:18 UTC (rev 8219)
+++ trunk/matplotlib/examples/pylab_examples/histogram_demo_extended.py	2010年04月03日 23:22:48 UTC (rev 8220)
@@ -63,13 +63,18 @@
 
 #
 # histogram has the ability to plot multiple data in parallel ...
+# Note the new color kwarg, used to override the default, which
+# uses the line color cycle.
 #
 P.figure()
 
 # create a new data-set
 x = mu + sigma*P.randn(1000,3)
 
-n, bins, patches = P.hist(x, 10, normed=1, histtype='bar')
+n, bins, patches = P.hist(x, 10, normed=1, histtype='bar',
+ color=['crimson', 'burlywood', 'chartreuse'],
+ label=['Crimson', 'Burlywood', 'Chartreuse'])
+P.legend()
 
 #
 # ... or we can stack the data
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
From: <ef...@us...> - 2010年04月03日 07:18:24
Revision: 8219
 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=8219&view=rev
Author: efiring
Date: 2010年04月03日 07:18:18 +0000 (2010年4月03日)
Log Message:
-----------
Axes.hist: add color kwarg.
Modified Paths:
--------------
 trunk/matplotlib/lib/matplotlib/axes.py
Modified: trunk/matplotlib/lib/matplotlib/axes.py
===================================================================
--- trunk/matplotlib/lib/matplotlib/axes.py	2010年04月02日 21:29:38 UTC (rev 8218)
+++ trunk/matplotlib/lib/matplotlib/axes.py	2010年04月03日 07:18:18 UTC (rev 8219)
@@ -7097,8 +7097,10 @@
 *patches*) will be returned.
 
 *color*:
+ Color spec or sequence of color specs, one per
+ dataset. Default (*None*) uses the standard line
+ color sequence.
 
-
 kwargs are used to update the properties of the hist
 :class:`~matplotlib.patches.Rectangle` instances:
 
@@ -7163,6 +7165,14 @@
 
 nx = len(x) # number of datasets
 
+ if color is None:
+ color = [self._get_lines.color_cycle.next()
+ for i in xrange(nx)]
+ else:
+ color = mcolors.colorConverter.to_rgba_array(color)
+ if len(color) != nx:
+ raise ValueError("color kwarg must have one color per dataset")
+
 if weights is not None:
 if isinstance(w, np.ndarray):
 w = np.array(weights)
@@ -7245,11 +7255,10 @@
 else: # orientation == 'vertical'
 _barfunc = self.bar
 
- for m in n:
- color = self._get_lines.color_cycle.next()
+ for m, c in zip(n, color):
 patch = _barfunc(bins[:-1]+boffset, m, width, bottom,
 align='center', log=log,
- color=color)
+ color=c)
 patches.append(patch)
 if stacked:
 if bottom is None:
@@ -7277,20 +7286,19 @@
 
 fill = (histtype == 'stepfilled')
 
- for m in n:
+ for m, c in zip(n, color):
 y[1:-1:2], y[2::2] = m, m
 if log:
 y[y<1e-100]=1e-100
 if orientation == 'horizontal':
 x,y = y,x
 
- color = self._get_lines.color_cycle.next()
 if fill:
 patches.append( self.fill(x, y,
- closed=False, facecolor=color) )
+ closed=False, facecolor=c) )
 else:
 patches.append( self.fill(x, y,
- closed=False, edgecolor=color, fill=False) )
+ closed=False, edgecolor=c, fill=False) )
 
 # adopted from adjust_x/ylim part of the bar method
 if orientation == 'horizontal':
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.

Showing 2 results of 2

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.
Thanks for helping keep SourceForge clean.
X





Briefly describe the problem (required):
Upload screenshot of ad (required):
Select a file, or drag & drop file here.
Screenshot instructions:

Click URL instructions:
Right-click on the ad, choose "Copy Link", then paste here →
(This may not be possible with some types of ads)

More information about our ad policies

Ad destination/click URL:

AltStyle によって変換されたページ (->オリジナル) /