From: <ef...@us...> - 2008-05-24 07:36:51
|
Revision: 5250 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=5250&view=rev Author: efiring Date: 2008-05-24 00:36:47 -0700 (Sat, 24 May 2008) Log Message: ----------- Provide function and method to control the plot color cycle Modified Paths: -------------- trunk/matplotlib/API_CHANGES trunk/matplotlib/CHANGELOG trunk/matplotlib/examples/tests/backend_driver.py trunk/matplotlib/lib/matplotlib/axes.py Modified: trunk/matplotlib/API_CHANGES =================================================================== --- trunk/matplotlib/API_CHANGES 2008-05-24 00:51:33 UTC (rev 5249) +++ trunk/matplotlib/API_CHANGES 2008-05-24 07:36:47 UTC (rev 5250) @@ -1,3 +1,7 @@ + New axes function and Axes method provide control over the plot + color cycle: axes.set_default_color_cycle(clist) and + Axes.set_color_cycle(clist). + matplotlib now requires python2.4, so matplotlib.cbook will no loner provide set, enumerate, reversed or izip compatability functions @@ -2,3 +6,3 @@ In numpy 1.0 bins are specified by the left edges only. The axes - method "hist" now uses future numpy 1.3 semantic for histograms. + method "hist" now uses future numpy 1.3 semantic for histograms. Providing binedges, the last value gives the upper-right edge now, Modified: trunk/matplotlib/CHANGELOG =================================================================== --- trunk/matplotlib/CHANGELOG 2008-05-24 00:51:33 UTC (rev 5249) +++ trunk/matplotlib/CHANGELOG 2008-05-24 07:36:47 UTC (rev 5250) @@ -1,3 +1,6 @@ +2008-05-23 Provided a function and a method for controlling the + plot color cycle. - EF + 2008-05-23 Major revision of hist(). Can handle 2D arrays and create stacked histogram plots; keyword 'width' deprecated and rwidth (relative width) introduced; align='edge' changed Modified: trunk/matplotlib/examples/tests/backend_driver.py =================================================================== --- trunk/matplotlib/examples/tests/backend_driver.py 2008-05-24 00:51:33 UTC (rev 5249) +++ trunk/matplotlib/examples/tests/backend_driver.py 2008-05-24 07:36:47 UTC (rev 5250) @@ -114,6 +114,7 @@ api_dir = os.path.join('..', 'api') api_files = [ 'colorbar_only.py', + 'color_cycle.py', ] Modified: trunk/matplotlib/lib/matplotlib/axes.py =================================================================== --- trunk/matplotlib/lib/matplotlib/axes.py 2008-05-24 00:51:33 UTC (rev 5249) +++ trunk/matplotlib/lib/matplotlib/axes.py 2008-05-24 07:36:47 UTC (rev 5250) @@ -135,6 +135,18 @@ return linestyle, marker, color +def set_default_color_cycle(clist): + """ + Change the default cycle of colors that will be used by the plot + command. This must be called before creating the Axes to which + it will apply; it will apply to all future Axes. + + clist is a sequence of mpl color specifiers + + """ + _process_plot_var_args.defaultColors = clist[:] + rcParams['lines.color'] = clist[0] + class _process_plot_var_args: """ @@ -170,6 +182,12 @@ self.count = 0 + def set_color_cycle(self, clist): + self.colors = clist[:] + self.firstColor = self.colors[0] + self.Ncolors = len(self.colors) + self.count = 0 + def _get_next_cycle_color(self): if self.count==0: color = self.firstColor @@ -828,6 +846,15 @@ 'clear the axes' self.cla() + def set_color_cycle(self, clist): + """ + Set the color cycle for any future plot commands on this Axes. + + clist is a list of mpl color specifiers. + """ + self._get_lines.set_color_cycle(clist) + + def ishold(self): 'return the HOLD status of the axes' return self._hold This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |