SF.net SVN: matplotlib: [5250] trunk/matplotlib
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_CHANGES2008-05-24 00:51:33 UTC (rev 5249)
+++ trunk/matplotlib/API_CHANGES2008-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.
-
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2008.
http://clk.atdmt.com/MRT/go/vse012070mrt/direct/01/
___
Matplotlib-checkins mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/matplotlib-checkins
SF.net SVN: matplotlib: [5251] trunk/matplotlib/examples/api/color_cycle.py
Revision: 5251
http://matplotlib.svn.sourceforge.net/matplotlib/?rev=5251&view=rev
Author: efiring
Date: 2008-05-24 00:43:13 -0700 (Sat, 24 May 2008)
Log Message:
---
Forgot to add the example on last commit
Added Paths:
---
trunk/matplotlib/examples/api/color_cycle.py
Added: trunk/matplotlib/examples/api/color_cycle.py
===
--- trunk/matplotlib/examples/api/color_cycle.py
(rev 0)
+++ trunk/matplotlib/examples/api/color_cycle.py2008-05-24 07:43:13 UTC
(rev 5251)
@@ -0,0 +1,28 @@
+"""
+Illustrate the API for changing the cycle of colors used
+when plotting multiple lines on a single Axes.
+"""
+
+import numpy as np
+import matplotlib.pyplot as plt
+import matplotlib as mpl
+
+yy = np.arange(24)
+yy.shape = 6,4
+
+mpl.rc('lines', linewidth=4)
+
+fig = plt.figure()
+mpl.axes.set_default_color_cycle(['r', 'g', 'b', 'c'])
+ax = fig.add_subplot(2,1,1)
+ax.plot(yy)
+ax.set_title('Changed default color cycle to rgbc')
+
+ax = fig.add_subplot(2,1,2)
+ax.set_color_cycle(['c', 'm', 'y', 'k'])
+ax.plot(yy)
+ax.set_title('This axes only, cycle is cmyk')
+
+plt.show()
+
+
This was sent by the SourceForge.net collaborative development platform, the
world's largest Open Source development site.
-
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2008.
http://clk.atdmt.com/MRT/go/vse012070mrt/direct/01/
___
Matplotlib-checkins mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/matplotlib-checkins
SF.net SVN: matplotlib: [5252] trunk/matplotlib
Revision: 5252
http://matplotlib.svn.sourceforge.net/matplotlib/?rev=5252&view=rev
Author: jdh2358
Date: 2008-05-24 10:55:54 -0700 (Sat, 24 May 2008)
Log Message:
---
fixed a wx bug and added PIL support to imread
Modified Paths:
--
trunk/matplotlib/CHANGELOG
trunk/matplotlib/lib/matplotlib/backends/backend_wx.py
trunk/matplotlib/lib/matplotlib/image.py
trunk/matplotlib/lib/matplotlib/patches.py
Modified: trunk/matplotlib/CHANGELOG
===
--- trunk/matplotlib/CHANGELOG 2008-05-24 07:43:13 UTC (rev 5251)
+++ trunk/matplotlib/CHANGELOG 2008-05-24 17:55:54 UTC (rev 5252)
@@ -1,3 +1,6 @@
+2008-05-24 Added PIL support for loading images to imread (if PIL is
+ available) - JDH
+
2008-05-23 Provided a function and a method for controlling the
plot color cycle. - EF
Modified: trunk/matplotlib/lib/matplotlib/backends/backend_wx.py
===
--- trunk/matplotlib/lib/matplotlib/backends/backend_wx.py 2008-05-24
07:43:13 UTC (rev 5251)
+++ trunk/matplotlib/lib/matplotlib/backends/backend_wx.py 2008-05-24
17:55:54 UTC (rev 5252)
@@ -1234,7 +1234,7 @@
statbar = StatusBarWx(self)
self.SetStatusBar(statbar)
self.canvas = self.get_canvas(fig)
-self.canvas.SetInitialSize(wx.Size(fig.bbox.width(),
fig.bbox.height()))
+self.canvas.SetInitialSize(wx.Size(fig.bbox.width, fig.bbox.height))
self.sizer =wx.BoxSizer(wx.VERTICAL)
self.sizer.Add(self.canvas, 1, wx.TOP | wx.LEFT | wx.EXPAND)
# By adding toolbar in sizer, we are able to put it at the bottom
Modified: trunk/matplotlib/lib/matplotlib/image.py
===
--- trunk/matplotlib/lib/matplotlib/image.py2008-05-24 07:43:13 UTC (rev
5251)
+++ trunk/matplotlib/lib/matplotlib/image.py2008-05-24 17:55:54 UTC (rev
5252)
@@ -652,13 +652,29 @@
Return value is a MxNx4 array of 0-1 normalized floats
+matplotlib can only read PNGs natively, but if PIL is installed,
+it will use it to load the image and return an RGBA if possible
+which can be used with imshow
"""
+
+def pilread():
+'try to load the image with PIL or return None'
+try: import Image
+except ImportError: return None
+image = Image.open( fname )
+return pil_to_array(image)
+
+
handlers = {'png' :_image.readpng,
}
basename, ext = os.path.splitext(fname)
ext = ext.lower()[1:]
+
if ext not in handlers.keys():
-raise ValueError('Only know how to handled extensions: %s' %
handlers.keys())
+im = pilread()
+if im is None:
+raise ValueError('Only know how to handle extensions: %s; with PIL
installed matplotlib can handle more images' % handlers.keys())
+return im
handler = handlers[ext]
return handler(fname)
Modified: trunk/matplotlib/lib/matplotlib/patches.py
===
--- trunk/matplotlib/lib/matplotlib/patches.py 2008-05-24 07:43:13 UTC (rev
5251)
+++ trunk/matplotlib/lib/matplotlib/patches.py 2008-05-24 17:55:54 UTC (rev
5252)
@@ -11,8 +11,8 @@
from matplotlib.path import Path
# these are not available for the object inspector until after the
-# class is build so we define an initial set here for the init
-# function and they will be overridden after object defn
+# class is built so we define an initial set here for the init
+# function and they will be overridden after object definition
artist.kwdocd['Patch'] = """\
alpha: float
animated: [True | False]
@@ -31,7 +31,6 @@
visible: [True | False]
zorder: any number
"""
-
class Patch(artist.Artist):
"""
A patch is a 2D thingy with a face color and an edge color
@@ -1109,7 +1108,6 @@
r.draw(renderer)
artist.kwdocd['Patch'] = patchdoc = artist.kwdoc(Patch)
-
for k in ('Rectangle', 'Circle', 'RegularPolygon', 'Polygon', 'Wedge', 'Arrow',
'FancyArrow', 'YAArrow', 'CirclePolygon', 'Ellipse'):
artist.kwdocd[k] = patchdoc
This was sent by the SourceForge.net collaborative development platform, the
world's largest Open Source development site.
-
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2008.
http://clk.atdmt.com/MRT/go/vse012070mrt/direct/01/
___
Matplotlib-checkins mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/matplotlib-checkins
SF.net SVN: matplotlib: [5254] trunk/matplotlib/docs
Revision: 5254
http://matplotlib.svn.sourceforge.net/matplotlib/?rev=5254&view=rev
Author: jdh2358
Date: 2008-05-24 14:04:44 -0700 (Sat, 24 May 2008)
Log Message:
---
fixed the latex build
Modified Paths:
--
trunk/matplotlib/docs/conf.py
trunk/matplotlib/docs/make.py
Modified: trunk/matplotlib/docs/conf.py
===
--- trunk/matplotlib/docs/conf.py 2008-05-24 20:49:31 UTC (rev 5253)
+++ trunk/matplotlib/docs/conf.py 2008-05-24 21:04:44 UTC (rev 5254)
@@ -139,10 +139,12 @@
# Grouping the document tree into LaTeX files. List of tuples
# (source start file, target name, title, author, document class
[howto/manual]).
+
latex_documents = [
- ('index', 'Matplotlib.tex', 'Matplotlib', 'John Hunter, Darren Dale',
'Michael Droettboom', 'manual'),
+ ('index', 'Matplotlib.tex', 'Matplotlib', 'John Hunter, Darren Dale, Michael
Droettboom', 'manual'),
]
+
# The name of an image file (relative to this directory) to place at the top of
# the title page.
latex_logo = None
Modified: trunk/matplotlib/docs/make.py
===
--- trunk/matplotlib/docs/make.py 2008-05-24 20:49:31 UTC (rev 5253)
+++ trunk/matplotlib/docs/make.py 2008-05-24 21:04:44 UTC (rev 5254)
@@ -30,11 +30,11 @@
os.chdir('build/latex')
# Copying the makefile produced by sphinx...
-os.system('pdflatex Matplotlib_Users_Guide.tex')
-os.system('pdflatex Matplotlib_Users_Guide.tex')
-os.system('makeindex -s python.ist Matplotlib_Users_Guide.idx')
-os.system('makeindex -s python.ist modMatplotlib_Users_Guide.idx')
-os.system('pdflatex Matplotlib_Users_Guide.tex')
+os.system('pdflatex Matplotlib.tex')
+os.system('pdflatex Matplotlib.tex')
+os.system('makeindex -s python.ist Matplotlib.idx')
+os.system('makeindex -s python.ist modMatplotlib.idx')
+os.system('pdflatex Matplotlib.tex')
os.chdir('../..')
else:
This was sent by the SourceForge.net collaborative development platform, the
world's largest Open Source development site.
-
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2008.
http://clk.atdmt.com/MRT/go/vse012070mrt/direct/01/
___
Matplotlib-checkins mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/matplotlib-checkins
SF.net SVN: matplotlib: [5255] trunk/matplotlib/doc/
Revision: 5255 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=5255&view=rev Author: jdh2358 Date: 2008-05-24 14:05:14 -0700 (Sat, 24 May 2008) Log Message: --- removed old doc dir Removed Paths: - trunk/matplotlib/doc/ This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. - This SF.net email is sponsored by: Microsoft Defy all challenges. Microsoft(R) Visual Studio 2008. http://clk.atdmt.com/MRT/go/vse012070mrt/direct/01/ ___ Matplotlib-checkins mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/matplotlib-checkins
SF.net SVN: matplotlib: [5256] trunk/matplotlib/lib/matplotlib/backends/ backend_wx.py
Revision: 5256
http://matplotlib.svn.sourceforge.net/matplotlib/?rev=5256&view=rev
Author: jdh2358
Date: 2008-05-24 18:30:32 -0700 (Sat, 24 May 2008)
Log Message:
---
added tonys wx loan icon patch
Modified Paths:
--
trunk/matplotlib/lib/matplotlib/backends/backend_wx.py
Modified: trunk/matplotlib/lib/matplotlib/backends/backend_wx.py
===
--- trunk/matplotlib/lib/matplotlib/backends/backend_wx.py 2008-05-24
21:05:14 UTC (rev 5255)
+++ trunk/matplotlib/lib/matplotlib/backends/backend_wx.py 2008-05-25
01:30:32 UTC (rev 5256)
@@ -1383,9 +1383,6 @@
matplotlib library is installed. The filename parameter should not
contain any path information as this is determined automatically.
-Bitmaps should be in XPM format, and of size 16x16 (unless you change
-the code!). I have converted the stock GTK2 16x16 icons to XPM format.
-
Returns a wx.Bitmap object
"""
@@ -1395,27 +1392,9 @@
if not os.path.exists(bmpFilename):
raise IOError('Could not find bitmap file "%s"; dying'%bmpFilename)
-bmp =wx.Bitmap(bmpFilename, wx.BITMAP_TYPE_XPM)
+bmp = wx.Bitmap(bmpFilename)
return bmp
-def _load_pngicon(filename):
-"""
-Load a png icon file from the backends/images subdirectory in which the
-matplotlib library is installed. The filename parameter should not
-contain any path information as this is determined automatically.
-
-Returns a wx.Bitmap object
-"""
-
-basedir = os.path.join(rcParams['datapath'],'images')
-
-pngFilename = os.path.normpath(os.path.join(basedir, filename))
-if not os.path.exists(pngFilename):
-raise IOError('Could not find bitmap file "%s"; dying'%pngFilename)
-
-png =wx.Bitmap(pngFilename, wx.BITMAP_TYPE_PNG)
-return png
-
class MenuButtonWx(wx.Button):
"""
wxPython does not permit a menu to be incorporated directly into a toolbar.
@@ -1576,24 +1555,24 @@
self.SetToolBitmapSize(wx.Size(24,24))
-self.AddSimpleTool(_NTB2_HOME, _load_pngicon('home.png'),
+self.AddSimpleTool(_NTB2_HOME, _load_bitmap('home.png'),
'Home', 'Reset original view')
-self.AddSimpleTool(self._NTB2_BACK, _load_pngicon('back.png'),
+self.AddSimpleTool(self._NTB2_BACK, _load_bitmap('back.png'),
'Back', 'Back navigation view')
-self.AddSimpleTool(self._NTB2_FORWARD, _load_pngicon('forward.png'),
+self.AddSimpleTool(self._NTB2_FORWARD, _load_bitmap('forward.png'),
'Forward', 'Forward navigation view')
# todo: get new bitmap
-self.AddCheckTool(self._NTB2_PAN, _load_pngicon('move.png'),
+self.AddCheckTool(self._NTB2_PAN, _load_bitmap('move.png'),
shortHelp='Pan',
longHelp='Pan with left, zoom with right')
-self.AddCheckTool(self._NTB2_ZOOM, _load_pngicon('zoom_to_rect.png'),
+self.AddCheckTool(self._NTB2_ZOOM, _load_bitmap('zoom_to_rect.png'),
shortHelp='Zoom', longHelp='Zoom to rectangle')
self.AddSeparator()
-self.AddSimpleTool(_NTB2_SUBPLOT, _load_pngicon('subplots.png'),
+self.AddSimpleTool(_NTB2_SUBPLOT, _load_bitmap('subplots.png'),
'Configure subplots', 'Configure subplot
parameters')
-self.AddSimpleTool(_NTB2_SAVE, _load_pngicon('filesave.png'),
+self.AddSimpleTool(_NTB2_SAVE, _load_bitmap('filesave.png'),
'Save', 'Save plot contents to file')
if wx.VERSION_STRING >= '2.5':
This was sent by the SourceForge.net collaborative development platform, the
world's largest Open Source development site.
-
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2008.
http://clk.atdmt.com/MRT/go/vse012070mrt/direct/01/
___
Matplotlib-checkins mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/matplotlib-checkins
