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
(5) |
3
(7) |
4
(1) |
5
(2) |
6
|
7
|
8
(2) |
9
(4) |
10
(1) |
11
|
12
(2) |
13
(3) |
14
|
15
(2) |
16
(2) |
17
|
18
|
19
(3) |
20
(5) |
21
(5) |
22
(1) |
23
(2) |
24
(1) |
25
(1) |
26
|
27
|
28
|
29
|
30
|
31
|
|
|
|
Revision: 8214 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=8214&view=rev Author: ryanmay Date: 2010年03月25日 14:17:17 +0000 (2010年3月25日) Log Message: ----------- Correct docstring for ScalarFormatter to represent current behavior. Modified Paths: -------------- trunk/matplotlib/lib/matplotlib/ticker.py Modified: trunk/matplotlib/lib/matplotlib/ticker.py =================================================================== --- trunk/matplotlib/lib/matplotlib/ticker.py 2010年03月24日 04:45:19 UTC (rev 8213) +++ trunk/matplotlib/lib/matplotlib/ticker.py 2010年03月25日 14:17:17 UTC (rev 8214) @@ -318,7 +318,9 @@ Tick location is a plain old number. If useOffset==True and the data range is much smaller than the data average, then an offset will be determined such that the tick labels are meaningful. Scientific notation is used for - data < 1e-3 or data >= 1e4. + data < 10^-n or data >= 10^m, where n and m are the power limits set using + set_powerlimits((n,m)). The defaults for these are controlled by the + axes.formatter.limits rc parameter. """ def __init__(self, useOffset=True, useMathText=False): This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
Revision: 8213 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=8213&view=rev Author: leejjoon Date: 2010年03月24日 04:45:19 +0000 (2010年3月24日) Log Message: ----------- refactor colorbar code so that no cla() is necessary when mappable is changed Modified Paths: -------------- trunk/matplotlib/CHANGELOG trunk/matplotlib/lib/matplotlib/colorbar.py trunk/matplotlib/lib/matplotlib/figure.py Modified: trunk/matplotlib/CHANGELOG =================================================================== --- trunk/matplotlib/CHANGELOG 2010年03月23日 17:37:51 UTC (rev 8212) +++ trunk/matplotlib/CHANGELOG 2010年03月24日 04:45:19 UTC (rev 8213) @@ -1,3 +1,6 @@ +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 leaves the axes. -JJL Modified: trunk/matplotlib/lib/matplotlib/colorbar.py =================================================================== --- trunk/matplotlib/lib/matplotlib/colorbar.py 2010年03月23日 17:37:51 UTC (rev 8212) +++ trunk/matplotlib/lib/matplotlib/colorbar.py 2010年03月24日 04:45:19 UTC (rev 8213) @@ -223,6 +223,8 @@ self.filled = filled self.solids = None self.lines = None + self.outline = None + self.patch = None self.dividers = None self.set_label('') if cbook.iterable(ticks): @@ -239,6 +241,7 @@ else: self.formatter = format # Assume it is a Formatter # The rest is in a method so we can recalculate when clim changes. + self.config_axis() self.draw_all() def _patch_ax(self): @@ -260,6 +263,17 @@ self._config_axes(X, Y) if self.filled: self._add_solids(X, Y, C) + + def config_axis(self): + ax = self.ax + if self.orientation == 'vertical': + ax.xaxis.set_ticks([]) + ax.yaxis.set_label_position('right') + ax.yaxis.set_ticks_position('right') + else: + ax.yaxis.set_ticks([]) + ax.xaxis.set_label_position('bottom') + self._set_label() def update_ticks(self): @@ -270,16 +284,11 @@ ax = self.ax ticks, ticklabels, offset_string = self._ticker() if self.orientation == 'vertical': - ax.xaxis.set_ticks([]) - ax.yaxis.set_label_position('right') - ax.yaxis.set_ticks_position('right') ax.yaxis.set_ticks(ticks) ax.set_yticklabels(ticklabels) ax.yaxis.get_major_formatter().set_offset_string(offset_string) else: - ax.yaxis.set_ticks([]) - ax.xaxis.set_label_position('bottom') ax.xaxis.set_ticks(ticks) ax.set_xticklabels(ticklabels) ax.xaxis.get_major_formatter().set_offset_string(offset_string) @@ -317,12 +326,16 @@ ax.update_datalim(xy) ax.set_xlim(*ax.dataLim.intervalx) ax.set_ylim(*ax.dataLim.intervaly) + if self.outline is not None: + self.outline.remove() self.outline = lines.Line2D(xy[:, 0], xy[:, 1], color=mpl.rcParams['axes.edgecolor'], linewidth=mpl.rcParams['axes.linewidth']) ax.add_artist(self.outline) self.outline.set_clip_box(None) self.outline.set_clip_path(None) c = mpl.rcParams['axes.facecolor'] + if self.patch is not None: + self.patch.remove() self.patch = patches.Polygon(xy, edgecolor=c, facecolor=c, linewidth=0.01, @@ -394,6 +407,9 @@ col = self.ax.pcolor(*args, **kw) self.ax.hold(_hold) #self.add_observer(col) # We should observe, not be observed... + + if self.solids is not None: + self.solids.remove() self.solids = col if self.drawedges: self.dividers = collections.LineCollection(self._edges(X,Y), @@ -417,6 +433,9 @@ else: xy = [zip(Y[i], X[i]) for i in range(N)] col = collections.LineCollection(xy, linewidths=linewidths) + + if self.lines: + self.lines.remove() self.lines = col col.set_color(colors) self.ax.add_collection(col) @@ -713,6 +732,19 @@ #print 'tlinewidths:', tlinewidths ColorbarBase.add_lines(self, CS.levels, tcolors, tlinewidths) + def update_normal(self, mappable): + ''' + update solid, lines, etc. Unlike update_bruteforce, it does + not clear the axes. This is meant to be called when the image + or contour plot to which this colorbar belongs is changed. + ''' + self.draw_all() + if isinstance(self.mappable, contour.ContourSet): + CS = self.mappable + if not CS.filled: + self.add_lines(CS) + + def update_bruteforce(self, mappable): ''' Manually change any contour line colors. This is called @@ -724,6 +756,7 @@ # properties have been changed by methods other than the # colorbar methods, those changes will be lost. self.ax.cla() + self.config_axis() self.draw_all() #if self.vmin != self.norm.vmin or self.vmax != self.norm.vmax: # self.ax.cla() Modified: trunk/matplotlib/lib/matplotlib/figure.py =================================================================== --- trunk/matplotlib/lib/matplotlib/figure.py 2010年03月23日 17:37:51 UTC (rev 8212) +++ trunk/matplotlib/lib/matplotlib/figure.py 2010年03月24日 04:45:19 UTC (rev 8213) @@ -1106,7 +1106,7 @@ #print 'calling on changed', m.get_cmap().name cb.set_cmap(m.get_cmap()) cb.set_clim(m.get_clim()) - cb.update_bruteforce(m) + cb.update_normal(m) self.cbid = mappable.callbacksSM.connect('changed', on_changed) mappable.set_colorbar(cb, cax) This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
Revision: 8212 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=8212&view=rev Author: leejjoon Date: 2010年03月23日 17:37:51 +0000 (2010年3月23日) Log Message: ----------- make filters dpi-independent in examples/pylab_examples/demo_agg_filter.py Modified Paths: -------------- trunk/matplotlib/examples/pylab_examples/demo_agg_filter.py Modified: trunk/matplotlib/examples/pylab_examples/demo_agg_filter.py =================================================================== --- trunk/matplotlib/examples/pylab_examples/demo_agg_filter.py 2010年03月23日 17:23:50 UTC (rev 8211) +++ trunk/matplotlib/examples/pylab_examples/demo_agg_filter.py 2010年03月23日 17:37:51 UTC (rev 8212) @@ -52,12 +52,12 @@ self.offsets = offsets def get_pad(self, dpi): - return max(*self.offsets) + return int(max(*self.offsets)/72.*dpi) def process_image(self, padded_src, dpi): ox, oy = self.offsets - a1 = np.roll(padded_src, ox, axis=1) - a2 = np.roll(a1, -oy, axis=0) + a1 = np.roll(padded_src, int(ox/72.*dpi), axis=1) + a2 = np.roll(a1, -int(oy/72.*dpi), axis=0) return a2 class GaussianFilter(BaseFilter): @@ -71,14 +71,14 @@ self.color=color def get_pad(self, dpi): - return int(self.sigma*3) + return int(self.sigma*3/72.*dpi) def process_image(self, padded_src, dpi): #offsetx, offsety = int(self.offsets[0]), int(self.offsets[1]) tgt_image = np.zeros_like(padded_src) aa = smooth2d(padded_src[:,:,-1]*self.alpha, - self.sigma) + self.sigma/72.*dpi) tgt_image[:,:,-1] = aa tgt_image[:,:,:-1] = self.color return tgt_image @@ -143,7 +143,7 @@ alpha = new_im[:,:,3] alpha.fill(0) alpha[pad:-pad, pad:-pad] = im[:,:,-1] - alpha2 = np.clip(smooth2d(alpha, self.pixels) * 5, 0, 1) + alpha2 = np.clip(smooth2d(alpha, self.pixels/72.*dpi) * 5, 0, 1) new_im[:,:,-1] = alpha2 new_im[:,:,:-1] = self.color offsetx, offsety = -pad, -pad @@ -206,8 +206,10 @@ fontsize=11) # change clable color to black + from matplotlib.patheffects import Normal for t in cl: t.set_color("k") + t.set_path_effects([Normal()]) # to force TextPath (i.e., same font in all backends) # Add white glows to improve visibility of labels. white_glows = FilteredArtistList(cl, GrowFilter(3)) This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
Revision: 8211 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=8211&view=rev Author: leejjoon Date: 2010年03月23日 17:23:50 +0000 (2010年3月23日) Log Message: ----------- remove scipy dependency in examples/pylab_examples/demo_agg_filter.py Modified Paths: -------------- trunk/matplotlib/examples/pylab_examples/demo_agg_filter.py Modified: trunk/matplotlib/examples/pylab_examples/demo_agg_filter.py =================================================================== --- trunk/matplotlib/examples/pylab_examples/demo_agg_filter.py 2010年03月22日 16:47:27 UTC (rev 8210) +++ trunk/matplotlib/examples/pylab_examples/demo_agg_filter.py 2010年03月23日 17:23:50 UTC (rev 8211) @@ -1,11 +1,30 @@ import matplotlib.pyplot as plt import numpy as np -import scipy.ndimage as NI import matplotlib.cm as cm import matplotlib.mlab as mlab +def smooth1d(x, window_len): + # copied from http://www.scipy.org/Cookbook/SignalSmooth + s=np.r_[2*x[0]-x[window_len:1:-1],x,2*x[-1]-x[-1:-window_len:-1]] + w = np.hanning(window_len) + y=np.convolve(w/w.sum(),s,mode='same') + return y[window_len-1:-window_len+1] + +def smooth2d(A, sigma=3): + + window_len = max(int(sigma), 3)*2+1 + A1 = np.array([smooth1d(x, window_len) for x in np.asarray(A)]) + A2 = np.transpose(A1) + A3 = np.array([smooth1d(x, window_len) for x in A2]) + A4 = np.transpose(A3) + + return A4 + + + + class BaseFilter(object): def prepare_image(self, src_image, dpi, pad): ny, nx, depth = src_image.shape @@ -58,8 +77,9 @@ def process_image(self, padded_src, dpi): #offsetx, offsety = int(self.offsets[0]), int(self.offsets[1]) tgt_image = np.zeros_like(padded_src) - tgt_image[:,:,-1] = NI.gaussian_filter(padded_src[:,:,-1]*self.alpha, - self.sigma) + aa = smooth2d(padded_src[:,:,-1]*self.alpha, + self.sigma) + tgt_image[:,:,-1] = aa tgt_image[:,:,:-1] = self.color return tgt_image @@ -123,7 +143,7 @@ alpha = new_im[:,:,3] alpha.fill(0) alpha[pad:-pad, pad:-pad] = im[:,:,-1] - alpha2 = NI.grey_dilation(alpha, size=(self.pixels, self.pixels)) + alpha2 = np.clip(smooth2d(alpha, self.pixels) * 5, 0, 1) new_im[:,:,-1] = alpha2 new_im[:,:,:-1] = self.color offsetx, offsety = -pad, -pad @@ -208,7 +228,7 @@ mec="r", mfc="w", lw=5, mew=3, ms=10, label="Line 1") - gauss = DropShadowFilter(2) + gauss = DropShadowFilter(4) for l in [l1, l2]: @@ -257,7 +277,7 @@ rects2 = ax.bar(ind+width+0.1, womenMeans, width, color='y', ec="w", lw=2) #gauss = GaussianFilter(1.5, offsets=(1,1), ) - gauss = DropShadowFilter(1.5, offsets=(1,1), ) + gauss = DropShadowFilter(5, offsets=(1,1), ) shadow = FilteredArtistList(rects1+rects2, gauss) ax.add_artist(shadow) shadow.set_zorder(rects1[0].get_zorder()-0.1) @@ -275,21 +295,21 @@ pies = ax.pie(fracs, explode=explode) ax.patch.set_visible(True) - light_filter = LightFilter(8) + light_filter = LightFilter(9) for p in pies[0]: p.set_agg_filter(light_filter) p.set_rasterized(True) # to support mixed-mode renderers p.set(ec="none", lw=2) - gauss = DropShadowFilter(3, offsets=(3,4), alpha=0.7) + gauss = DropShadowFilter(9, offsets=(3,4), alpha=0.7) shadow = FilteredArtistList(pies[0], gauss) ax.add_artist(shadow) shadow.set_zorder(pies[0][0].get_zorder()-0.1) if 1: - + plt.figure(1, figsize=(6, 6)) plt.subplots_adjust(left=0.05, right=0.95) This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
Revision: 8210 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=8210&view=rev Author: leejjoon Date: 2010年03月22日 16:47:27 +0000 (2010年3月22日) Log Message: ----------- fix incorrect rubber band during the zoom mode when mouse the axes Modified Paths: -------------- trunk/matplotlib/CHANGELOG trunk/matplotlib/lib/matplotlib/backend_bases.py Modified: trunk/matplotlib/CHANGELOG =================================================================== --- trunk/matplotlib/CHANGELOG 2010年03月21日 22:02:31 UTC (rev 8209) +++ trunk/matplotlib/CHANGELOG 2010年03月22日 16:47:27 UTC (rev 8210) @@ -1,3 +1,6 @@ +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 2010年03月20日 Added pyplot.sca() function suggested by JJL. - EF Modified: trunk/matplotlib/lib/matplotlib/backend_bases.py =================================================================== --- trunk/matplotlib/lib/matplotlib/backend_bases.py 2010年03月21日 22:02:31 UTC (rev 8209) +++ trunk/matplotlib/lib/matplotlib/backend_bases.py 2010年03月22日 16:47:27 UTC (rev 8210) @@ -2124,18 +2124,6 @@ if self._lastCursor != cursors.SELECT_REGION: self.set_cursor(cursors.SELECT_REGION) self._lastCursor = cursors.SELECT_REGION - if self._xypress: - x, y = event.x, event.y - lastx, lasty, a, ind, lim, trans = self._xypress[0] - - if self._zoom_mode == "x": - x1, y1, x2, y2 = event.inaxes.bbox.extents - y, lasty = y1, y2 - elif self._zoom_mode == "y": - x1, y1, x2, y2 = event.inaxes.bbox.extents - x, lastx = x1, x2 - - self.draw_rubberband(event, x, y, lastx, lasty) elif (self._active=='PAN' and self._lastCursor != cursors.MOVE): self.set_cursor(cursors.MOVE) @@ -2237,12 +2225,14 @@ and a.get_navigate() and a.can_zoom(): self._xypress.append(( x, y, a, i, a.viewLim.frozen(), a.transData.frozen())) - id1 = self.canvas.mpl_connect('key_press_event', + id1 = self.canvas.mpl_connect('motion_notify_event', self.drag_zoom) + + id2 = self.canvas.mpl_connect('key_press_event', self._switch_on_zoom_mode) - id2 = self.canvas.mpl_connect('key_release_event', + id3 = self.canvas.mpl_connect('key_release_event', self._switch_off_zoom_mode) - self._ids_zoom = id1, id2 + self._ids_zoom = id1, id2, id3 self._zoom_mode = event.key @@ -2301,6 +2291,29 @@ a.drag_pan(self._button_pressed, event.key, event.x, event.y) self.dynamic_update() + def drag_zoom(self, event): + 'the drag callback in zoom mode' + + if self._xypress: + x, y = event.x, event.y + lastx, lasty, a, ind, lim, trans = self._xypress[0] + + # adjust x, last, y, last + x1, y1, x2, y2 = a.bbox.extents + x, lastx = max(min(x, lastx), x1), min(max(x, lastx), x2) + y, lasty = max(min(y, lasty), y1), min(max(y, lasty), y2) + + if self._zoom_mode == "x": + x1, y1, x2, y2 = a.bbox.extents + y, lasty = y1, y2 + elif self._zoom_mode == "y": + x1, y1, x2, y2 = a.bbox.extents + x, lastx = x1, x2 + + self.draw_rubberband(event, x, y, lastx, lasty) + + + def release_zoom(self, event): 'the release mouse button callback in zoom to rect mode' if not self._xypress: return @@ -2313,7 +2326,6 @@ for cur_xypress in self._xypress: x, y = event.x, event.y lastx, lasty, a, ind, lim, trans = cur_xypress - # ignore singular clicks - 5 pixels is a threshold if abs(x-lastx)<5 or abs(y-lasty)<5: self._xypress = None This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
Revision: 8209 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=8209&view=rev Author: leejjoon Date: 2010年03月21日 22:02:31 +0000 (2010年3月21日) Log Message: ----------- x or y key during the zoom mode only change the x or y limits Modified Paths: -------------- trunk/matplotlib/CHANGELOG trunk/matplotlib/lib/matplotlib/backend_bases.py Modified: trunk/matplotlib/CHANGELOG =================================================================== --- trunk/matplotlib/CHANGELOG 2010年03月21日 19:27:52 UTC (rev 8208) +++ trunk/matplotlib/CHANGELOG 2010年03月21日 22:02:31 UTC (rev 8209) @@ -1,3 +1,5 @@ +2010年03月21日 x/y key during the zoom mode only changes the x/y limits. -JJL + 2010年03月20日 Added pyplot.sca() function suggested by JJL. - EF 2010年03月20日 Added conditional support for new Tooltip API in gtk backend. - EF Modified: trunk/matplotlib/lib/matplotlib/backend_bases.py =================================================================== --- trunk/matplotlib/lib/matplotlib/backend_bases.py 2010年03月21日 19:27:52 UTC (rev 8208) +++ trunk/matplotlib/lib/matplotlib/backend_bases.py 2010年03月21日 22:02:31 UTC (rev 8209) @@ -2049,6 +2049,10 @@ self._lastCursor = None self._init_toolbar() self._idDrag=self.canvas.mpl_connect('motion_notify_event', self.mouse_move) + + self._ids_zoom = None + self._zoom_mode = None + self._button_pressed = None # determined by the button pressed at start self.mode = '' # a mode string for the status bar @@ -2123,6 +2127,14 @@ if self._xypress: x, y = event.x, event.y lastx, lasty, a, ind, lim, trans = self._xypress[0] + + if self._zoom_mode == "x": + x1, y1, x2, y2 = event.inaxes.bbox.extents + y, lasty = y1, y2 + elif self._zoom_mode == "y": + x1, y1, x2, y2 = event.inaxes.bbox.extents + x, lastx = x1, x2 + self.draw_rubberband(event, x, y, lastx, lasty) elif (self._active=='PAN' and self._lastCursor != cursors.MOVE): @@ -2225,8 +2237,26 @@ and a.get_navigate() and a.can_zoom(): self._xypress.append(( x, y, a, i, a.viewLim.frozen(), a.transData.frozen())) + id1 = self.canvas.mpl_connect('key_press_event', + self._switch_on_zoom_mode) + id2 = self.canvas.mpl_connect('key_release_event', + self._switch_off_zoom_mode) + + self._ids_zoom = id1, id2 + + self._zoom_mode = event.key + + self.press(event) + def _switch_on_zoom_mode(self, event): + self._zoom_mode = event.key + self.mouse_move(event) + + def _switch_off_zoom_mode(self, event): + self._zoom_mode = None + self.mouse_move(event) + def push_current(self): 'push the current view limits and position onto the stack' lims = []; pos = [] @@ -2275,6 +2305,9 @@ 'the release mouse button callback in zoom to rect mode' if not self._xypress: return + for zoom_id in self._ids_zoom: + self.canvas.mpl_disconnect(zoom_id) + last_a = [] for cur_xypress in self._xypress: @@ -2334,8 +2367,13 @@ if y1 < Ymax: y1=Ymax if self._button_pressed == 1: - a.set_xlim((x0, x1)) - a.set_ylim((y0, y1)) + if self._zoom_mode == "x": + a.set_xlim((x0, x1)) + elif self._zoom_mode == "y": + a.set_ylim((y0, y1)) + else: + a.set_xlim((x0, x1)) + a.set_ylim((y0, y1)) elif self._button_pressed == 3: if a.get_xscale()=='log': alpha=np.log(Xmax/Xmin)/np.log(x1/x0) @@ -2353,13 +2391,21 @@ alpha=(Ymax-Ymin)/(y1-y0) ry1=alpha*(Ymin-y0)+Ymin ry2=alpha*(Ymax-y0)+Ymin - a.set_xlim((rx1, rx2)) - a.set_ylim((ry1, ry2)) + if self._zoom_mode == "x": + a.set_xlim((rx1, rx2)) + elif self._zoom_mode == "y": + a.set_ylim((ry1, ry2)) + else: + a.set_xlim((rx1, rx2)) + a.set_ylim((ry1, ry2)) + self.draw() self._xypress = None self._button_pressed = None + self._zoom_mode = None + self.push_current() self.release(event) This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
Revision: 8208 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=8208&view=rev Author: ryanmay Date: 2010年03月21日 19:27:52 +0000 (2010年3月21日) Log Message: ----------- Add second example from scipy cookbook to this script, showing the use of more traditional colormapping. Modified Paths: -------------- trunk/matplotlib/examples/pylab_examples/multicolored_line.py Modified: trunk/matplotlib/examples/pylab_examples/multicolored_line.py =================================================================== --- trunk/matplotlib/examples/pylab_examples/multicolored_line.py 2010年03月21日 17:43:11 UTC (rev 8207) +++ trunk/matplotlib/examples/pylab_examples/multicolored_line.py 2010年03月21日 19:27:52 UTC (rev 8208) @@ -28,9 +28,26 @@ lc = LineCollection(segments, cmap=cmap, norm=norm) lc.set_array(z) lc.set_linewidth(3) + +fig1 = plt.figure() plt.gca().add_collection(lc) - plt.xlim(x.min(), x.max()) plt.ylim(-1.1, 1.1) + +# Now do a second plot coloring the curve using a continuous colormap +t = np.linspace(0, 10, 200) +x = np.cos(np.pi * t) +y = np.sin(t) +points = np.array([x, y]).T.reshape(-1, 1, 2) +segments = np.concatenate([points[:-1], points[1:]], axis=1) + +lc = LineCollection(segments, cmap=plt.get_cmap('copper'), + norm=plt.Normalize(0, 10)) +lc.set_array(t) +lc.set_linewidth(3) + +fig2 = plt.figure() +plt.gca().add_collection(lc) +plt.xlim(-1, 1) +plt.ylim(-1, 1) plt.show() - This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
Revision: 8207 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=8207&view=rev Author: ryanmay Date: 2010年03月21日 17:43:11 +0000 (2010年3月21日) Log Message: ----------- Add multicolored line example based on an example from the scipy.org cookbook cleaned up to use colormaps. Added Paths: ----------- trunk/matplotlib/examples/pylab_examples/multicolored_line.py Added: trunk/matplotlib/examples/pylab_examples/multicolored_line.py =================================================================== --- trunk/matplotlib/examples/pylab_examples/multicolored_line.py (rev 0) +++ trunk/matplotlib/examples/pylab_examples/multicolored_line.py 2010年03月21日 17:43:11 UTC (rev 8207) @@ -0,0 +1,36 @@ +#!/usr/bin/env python +''' +Color parts of a line based on its properties, e.g., slope. +''' +import numpy as np +import matplotlib.pyplot as plt +from matplotlib.collections import LineCollection +from matplotlib.colors import ListedColormap, BoundaryNorm + +x = np.linspace(0, 3 * np.pi, 500) +y = np.sin(x) +z = np.cos(0.5 * (x[:-1] + x[1:])) # first derivative + +# Create a colormap for red, green and blue and a norm to color +# f' < -0.5 red, f' > 0.5 blue, and the rest green +cmap = ListedColormap(['r', 'g', 'b']) +norm = BoundaryNorm([-1, -0.5, 0.5, 1], cmap.N) + +# Create a set of line segments so that we can color them individually +# This creates the points as a N x 1 x 2 array so that we can stack points +# together easily to get the segments. The segments array for line collection +# needs to be numlines x points per line x 2 (x and y) +points = np.array([x, y]).T.reshape(-1, 1, 2) +segments = np.concatenate([points[:-1], points[1:]], axis=1) + +# Create the line collection object, setting the colormapping parameters. +# Have to set the actual values used for colormapping separately. +lc = LineCollection(segments, cmap=cmap, norm=norm) +lc.set_array(z) +lc.set_linewidth(3) +plt.gca().add_collection(lc) + +plt.xlim(x.min(), x.max()) +plt.ylim(-1.1, 1.1) +plt.show() + This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
Revision: 8206 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=8206&view=rev Author: efiring Date: 2010年03月21日 01:27:15 +0000 (2010年3月21日) Log Message: ----------- installing.rst: we require pygtk >= 2.4, not 2.2 Modified Paths: -------------- trunk/matplotlib/doc/users/installing.rst Modified: trunk/matplotlib/doc/users/installing.rst =================================================================== --- trunk/matplotlib/doc/users/installing.rst 2010年03月21日 00:39:04 UTC (rev 8205) +++ trunk/matplotlib/doc/users/installing.rst 2010年03月21日 01:27:15 UTC (rev 8206) @@ -162,14 +162,17 @@ :term:`pyqt` 4.0 or later The Qt4 widgets library python wrappers for the Qt4Agg backend -:term:`pygtk` 2.2 or later - The python wrappers for the GTK widgets library for use with the GTK or GTKAgg backend +:term:`pygtk` 2.4 or later + The python wrappers for the GTK widgets library for use with the + GTK or GTKAgg backend :term:`wxpython` 2.6 or later - The python wrappers for the wx widgets library for use with the WXAgg backend + The python wrappers for the wx widgets library for use with the + WXAgg backend :term:`wxpython` 2.8 or later - The python wrappers for the wx widgets library for use with the WX backend + The python wrappers for the wx widgets library for use with the + WX backend :term:`pyfltk` 1.0 or later The python wrappers of the FLTK widgets library for use with FLTKAgg This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
Revision: 8205 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=8205&view=rev Author: efiring Date: 2010年03月21日 00:39:04 +0000 (2010年3月21日) Log Message: ----------- pyplot: new sca() function suggested by LJJ Modified Paths: -------------- trunk/matplotlib/CHANGELOG trunk/matplotlib/lib/matplotlib/pyplot.py Modified: trunk/matplotlib/CHANGELOG =================================================================== --- trunk/matplotlib/CHANGELOG 2010年03月20日 23:24:29 UTC (rev 8204) +++ trunk/matplotlib/CHANGELOG 2010年03月21日 00:39:04 UTC (rev 8205) @@ -1,3 +1,5 @@ +2010年03月20日 Added pyplot.sca() function suggested by JJL. - EF + 2010年03月20日 Added conditional support for new Tooltip API in gtk backend. - EF 2010年03月20日 Changed plt.fig_subplot() to plt.subplots() after discussion on Modified: trunk/matplotlib/lib/matplotlib/pyplot.py =================================================================== --- trunk/matplotlib/lib/matplotlib/pyplot.py 2010年03月20日 23:24:29 UTC (rev 8204) +++ trunk/matplotlib/lib/matplotlib/pyplot.py 2010年03月21日 00:39:04 UTC (rev 8205) @@ -549,9 +549,20 @@ draw_if_interactive() return ret +def sca(ax): + """ + Set the current Axes instance to *ax*. The current Figure + is updated to the parent of *ax*. + """ + managers = _pylab_helpers.Gcf.get_all_fig_managers() + for m in managers: + if ax in m.canvas.figure.axes: + _pylab_helpers.Gcf.set_active(m) + m.canvas.figure.sca(ax) + return + raise ValueError("Axes instance argument was not found in a figure.") - def gca(**kwargs): """ Return the current axis instance. This can be used to control @@ -656,7 +667,7 @@ subplots, including the enclosing figure object, in a single call. Keyword arguments: - + nrows : int Number of rows of the subplot grid. Defaults to 1. @@ -670,7 +681,7 @@ If True, the Y axis will be shared amongst all subplots. squeeze : bool - + If True, extra dimensions are squeezed out from the returned axis object: - if only one subplot is constructed (nrows=ncols=1), the resulting single Axis object is returned as a scalar. @@ -696,7 +707,7 @@ - ax can be either a single axis object or an array of axis objects if more than one supblot was created. The dimensions of the resulting array can be controlled with the squeeze keyword, see above. - + **Examples:** x = np.linspace(0, 2*np.pi, 400) @@ -706,7 +717,7 @@ f, ax = plt.subplots() ax.plot(x, y) ax.set_title('Simple plot') - + # Two subplots, unpack the output array immediately f, (ax1, ax2) = plt.subplots(1, 2, sharey=True) ax1.plot(x, y) @@ -719,11 +730,11 @@ if subplot_kw is None: subplot_kw = {} - + fig = figure(**fig_kw) # Create empty object array to hold all axes. It's easiest to make it 1-d - # so we can just append subplots upon creation, and then + # so we can just append subplots upon creation, and then nplots = nrows*ncols axarr = np.empty(nplots, dtype=object) @@ -734,9 +745,9 @@ if sharey: subplot_kw['sharey'] = ax0 axarr[0] = ax0 - + # Note off-by-one counting because add_subplot uses the matlab 1-based - # convention. + # convention. for i in range(1, nplots): axarr[i] = fig.add_subplot(nrows, ncols, i+1, **subplot_kw) This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
Revision: 8204 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=8204&view=rev Author: efiring Date: 2010年03月20日 23:24:29 +0000 (2010年3月20日) Log Message: ----------- CHANGELOG update and format fixups; fix python version info in INSTALL Modified Paths: -------------- trunk/matplotlib/CHANGELOG trunk/matplotlib/INSTALL Modified: trunk/matplotlib/CHANGELOG =================================================================== --- trunk/matplotlib/CHANGELOG 2010年03月20日 22:49:25 UTC (rev 8203) +++ trunk/matplotlib/CHANGELOG 2010年03月20日 23:24:29 UTC (rev 8204) @@ -1,16 +1,20 @@ +2010年03月20日 Added conditional support for new Tooltip API in gtk backend. - EF + 2010年03月20日 Changed plt.fig_subplot() to plt.subplots() after discussion on - list, and changed its API to return axes as a numpy object array - (with control of dimensions via squeeze keyword). FP. + list, and changed its API to return axes as a numpy object array + (with control of dimensions via squeeze keyword). FP. 2010年03月13日 Manually brought in commits from branch ------------------------------------------------------------------------ r8191 | leejjoon | 2010年03月13日 17:27:57 -0500 (2010年3月13日) | 1 line - fix the bug that handles for scatter are incorrectly set when dpi!=72. Thanks to Ray Speth for the bug report. + fix the bug that handles for scatter are incorrectly set when dpi!=72. + Thanks to Ray Speth for the bug report. -2010年03月03日 Manually brought in commits from branch via diff/patch (svnmerge is broken) +2010年03月03日 Manually brought in commits from branch via diff/patch + (svnmerge is broken) ------------------------------------------------------------------------ r8175 | leejjoon | 2010年03月03日 10:03:30 -0800 (2010年3月03日) | 1 line @@ -35,15 +39,15 @@ 2010年02月25日 add annotation_demo3.py that demonstrates new functionality. -JJL -2010年02月25日 refactor Annotation to support arbitrary Transform as xycoords - or textcoords. Also, if a tuple of two coordinates is provided, - they are interpreted as coordinates for each x and y position. +2010年02月25日 refactor Annotation to support arbitrary Transform as xycoords + or textcoords. Also, if a tuple of two coordinates is provided, + they are interpreted as coordinates for each x and y position. -JJL 2010年02月24日 Added pyplot.fig_subplot(), to create a figure and a group of - subplots in a single call. This offers an easier pattern than - manually making figures and calling add_subplot() multiple times. FP - + subplots in a single call. This offers an easier pattern than + manually making figures and calling add_subplot() multiple times. FP + 2010年02月17日 Added Gokhan's and Mattias' customizable keybindings patch for the toolbar. You can now set the keymap.* properties in the matplotlibrc file. Newbindings were added for @@ -67,7 +71,7 @@ warnings can be turned into fatal errors easily if desired. - FP 2010年01月29日 Added draggable method to Legend to allow mouse drag -placement. Thanks Adam Fraser. JDH + placement. Thanks Adam Fraser. JDH 2010年01月25日 Fixed a bug reported by Olle Engdegard, when using histograms with stepfilled and log=True - MM Modified: trunk/matplotlib/INSTALL =================================================================== --- trunk/matplotlib/INSTALL 2010年03月20日 22:49:25 UTC (rev 8203) +++ trunk/matplotlib/INSTALL 2010年03月20日 23:24:29 UTC (rev 8204) @@ -1,7 +1,7 @@ INTRODUCTION - matplotlib requires at a minimum python 2.3, numpy, libpng and + matplotlib requires at a minimum python 2.4, numpy, libpng and freetype. To get the most out of matplotlib, you will want to build some of the optional GUI and image extensions, discussed below. Matplotlib is known to work on linux, unix, win32 and OS X This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
Revision: 8203 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=8203&view=rev Author: efiring Date: 2010年03月20日 22:49:25 +0000 (2010年3月20日) Log Message: ----------- backend_gtk: support new tooltip API for pygtk >= 2.12 Modified Paths: -------------- trunk/matplotlib/lib/matplotlib/backends/backend_gtk.py Modified: trunk/matplotlib/lib/matplotlib/backends/backend_gtk.py =================================================================== --- trunk/matplotlib/lib/matplotlib/backends/backend_gtk.py 2010年03月20日 08:58:06 UTC (rev 8202) +++ trunk/matplotlib/lib/matplotlib/backends/backend_gtk.py 2010年03月20日 22:49:25 UTC (rev 8203) @@ -17,6 +17,8 @@ % (gtk.pygtk_version + pygtk_version_required)) del pygtk_version_required +_new_tooltip_api = (gtk.pygtk_version[1] >= 12) + import matplotlib from matplotlib import verbose from matplotlib._pylab_helpers import Gcf @@ -448,7 +450,7 @@ # diong a blanket catch here, but an not sure what a # better way is - JDH verbose.report('Could not load matplotlib icon: %s' % sys.exc_info()[1]) - + self.vbox = gtk.VBox() self.window.add(self.vbox) self.vbox.show() @@ -618,7 +620,8 @@ def _init_toolbar2_4(self): basedir = os.path.join(matplotlib.rcParams['datapath'],'images') - self.tooltips = gtk.Tooltips() + if not _new_tooltip_api: + self.tooltips = gtk.Tooltips() for text, tooltip_text, image_file, callback in self.toolitems: if text is None: @@ -630,7 +633,10 @@ tbutton = gtk.ToolButton(image, text) self.insert(tbutton, -1) tbutton.connect('clicked', getattr(self, callback)) - tbutton.set_tooltip(self.tooltips, tooltip_text, 'Private') + if _new_tooltip_api: + tbutton.set_tooltip_text(tooltip_text) + else: + tbutton.set_tooltip(self.tooltips, tooltip_text, 'Private') toolitem = gtk.SeparatorToolItem() self.insert(toolitem, -1) @@ -760,7 +766,8 @@ def _create_toolitems_2_4(self): # use the GTK+ 2.4 GtkToolbar API iconSize = gtk.ICON_SIZE_SMALL_TOOLBAR - self.tooltips = gtk.Tooltips() + if not _new_tooltip_api: + self.tooltips = gtk.Tooltips() for text, tooltip_text, image_num, callback, callback_arg, scroll \ in self.toolitems: @@ -778,15 +785,22 @@ tbutton.connect('clicked', getattr(self, callback)) if scroll: tbutton.connect('scroll_event', getattr(self, callback)) - tbutton.set_tooltip(self.tooltips, tooltip_text, 'Private') + if _new_tooltip_api: + tbutton.set_tooltip_text(tooltip_text) + else: + tbutton.set_tooltip(self.tooltips, tooltip_text, 'Private') # Axes toolitem, is empty at start, update() adds a menu if >=2 axes self.axes_toolitem = gtk.ToolItem() self.insert(self.axes_toolitem, 0) - self.axes_toolitem.set_tooltip ( - self.tooltips, - tip_text='Select axes that controls affect', - tip_private = 'Private') + if _new_tooltip_api: + self.axes_toolitem.set_tooltip_text( + 'Select axes that controls affect') + else: + self.axes_toolitem.set_tooltip ( + self.tooltips, + tip_text='Select axes that controls affect', + tip_private = 'Private') align = gtk.Alignment (xalign=0.5, yalign=0.5, xscale=0.0, yscale=0.0) self.axes_toolitem.add(align) This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
Revision: 8202 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=8202&view=rev Author: fer_perez Date: 2010年03月20日 08:58:06 +0000 (2010年3月20日) Log Message: ----------- Renamed to match new function name. Added Paths: ----------- trunk/matplotlib/examples/pylab_examples/subplots_demo.py Removed Paths: ------------- trunk/matplotlib/examples/pylab_examples/fig_subplot_demo.py Deleted: trunk/matplotlib/examples/pylab_examples/fig_subplot_demo.py =================================================================== --- trunk/matplotlib/examples/pylab_examples/fig_subplot_demo.py 2010年03月20日 08:57:37 UTC (rev 8201) +++ trunk/matplotlib/examples/pylab_examples/fig_subplot_demo.py 2010年03月20日 08:58:06 UTC (rev 8202) @@ -1,63 +0,0 @@ -"""Examples illustrating the use of plt.subplots(). - -This function creates a figure and a grid of subplots with a single call, while -providing reasonable control over how the individual plots are created. For -very refined tuning of subplot creation, you can still use add_subplot() -directly on a new figure. -""" - -import matplotlib.pyplot as plt -import numpy as np - -# Simple data to display in various forms -x = np.linspace(0, 2*np.pi, 400) -y = np.sin(x**2) - -plt.close('all') - -# Just a figure and one subplot -f, ax = plt.subplots() -ax.plot(x, y) -ax.set_title('Simple plot') - -# Two subplots, the axes array is 1-d -f, axarr = plt.subplots(2, sharex=True) -axarr[0].plot(x, y) -axarr[0].set_title('Sharing X axis') -axarr[1].scatter(x, y) - -# Two subplots, unpack the axes array immediately -f, (ax1, ax2) = plt.subplots(1, 2, sharey=True) -ax1.plot(x, y) -ax1.set_title('Sharing Y axis') -ax2.scatter(x, y) - -# Three subplots sharing both x/y axes -f, (ax1, ax2, ax3) = plt.subplots(3, sharex=True, sharey=True) -ax1.plot(x, y) -ax1.set_title('Sharing both axes') -ax2.scatter(x, y) -ax3.scatter(x, 2*y**2-1,color='r') -# Fine-tune figure; make subplots close to each other and hide x ticks for -# all but bottom plot. -f.subplots_adjust(hspace=0) -plt.setp([a.get_xticklabels() for a in f.axes[:-1]], visible=False) - -# Four axes, returned as a 2-d array -f, axarr = plt.subplots(2, 2) -axarr[0,0].plot(x, y) -axarr[0,0].set_title('Axis [0,0]') -axarr[0,1].scatter(x, y) -axarr[0,1].set_title('Axis [0,1]') -axarr[1,0].plot(x, y**2) -axarr[1,0].set_title('Axis [1,0]') -axarr[1,1].scatter(x, y**2) -axarr[1,1].set_title('Axis [1,1]') -# Fine-tune figure; hide x ticks for top plots and y ticks for right plots -plt.setp([a.get_xticklabels() for a in axarr[0,:]], visible=False) -plt.setp([a.get_yticklabels() for a in axarr[:,1]], visible=False) - -# Four polar axes -plt.subplots(2, 2, subplot_kw=dict(polar=True)) - -plt.show() Copied: trunk/matplotlib/examples/pylab_examples/subplots_demo.py (from rev 8201, trunk/matplotlib/examples/pylab_examples/fig_subplot_demo.py) =================================================================== --- trunk/matplotlib/examples/pylab_examples/subplots_demo.py (rev 0) +++ trunk/matplotlib/examples/pylab_examples/subplots_demo.py 2010年03月20日 08:58:06 UTC (rev 8202) @@ -0,0 +1,63 @@ +"""Examples illustrating the use of plt.subplots(). + +This function creates a figure and a grid of subplots with a single call, while +providing reasonable control over how the individual plots are created. For +very refined tuning of subplot creation, you can still use add_subplot() +directly on a new figure. +""" + +import matplotlib.pyplot as plt +import numpy as np + +# Simple data to display in various forms +x = np.linspace(0, 2*np.pi, 400) +y = np.sin(x**2) + +plt.close('all') + +# Just a figure and one subplot +f, ax = plt.subplots() +ax.plot(x, y) +ax.set_title('Simple plot') + +# Two subplots, the axes array is 1-d +f, axarr = plt.subplots(2, sharex=True) +axarr[0].plot(x, y) +axarr[0].set_title('Sharing X axis') +axarr[1].scatter(x, y) + +# Two subplots, unpack the axes array immediately +f, (ax1, ax2) = plt.subplots(1, 2, sharey=True) +ax1.plot(x, y) +ax1.set_title('Sharing Y axis') +ax2.scatter(x, y) + +# Three subplots sharing both x/y axes +f, (ax1, ax2, ax3) = plt.subplots(3, sharex=True, sharey=True) +ax1.plot(x, y) +ax1.set_title('Sharing both axes') +ax2.scatter(x, y) +ax3.scatter(x, 2*y**2-1,color='r') +# Fine-tune figure; make subplots close to each other and hide x ticks for +# all but bottom plot. +f.subplots_adjust(hspace=0) +plt.setp([a.get_xticklabels() for a in f.axes[:-1]], visible=False) + +# Four axes, returned as a 2-d array +f, axarr = plt.subplots(2, 2) +axarr[0,0].plot(x, y) +axarr[0,0].set_title('Axis [0,0]') +axarr[0,1].scatter(x, y) +axarr[0,1].set_title('Axis [0,1]') +axarr[1,0].plot(x, y**2) +axarr[1,0].set_title('Axis [1,0]') +axarr[1,1].scatter(x, y**2) +axarr[1,1].set_title('Axis [1,1]') +# Fine-tune figure; hide x ticks for top plots and y ticks for right plots +plt.setp([a.get_xticklabels() for a in axarr[0,:]], visible=False) +plt.setp([a.get_yticklabels() for a in axarr[:,1]], visible=False) + +# Four polar axes +plt.subplots(2, 2, subplot_kw=dict(polar=True)) + +plt.show() This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
Revision: 8201 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=8201&view=rev Author: fer_perez Date: 2010年03月20日 08:57:37 +0000 (2010年3月20日) Log Message: ----------- Renamed fig_subplot to suplots(), now returns numpy array with axes. Modified Paths: -------------- trunk/matplotlib/CHANGELOG trunk/matplotlib/examples/pylab_examples/fig_subplot_demo.py trunk/matplotlib/lib/matplotlib/pyplot.py Modified: trunk/matplotlib/CHANGELOG =================================================================== --- trunk/matplotlib/CHANGELOG 2010年03月20日 00:29:19 UTC (rev 8200) +++ trunk/matplotlib/CHANGELOG 2010年03月20日 08:57:37 UTC (rev 8201) @@ -1,3 +1,7 @@ +2010年03月20日 Changed plt.fig_subplot() to plt.subplots() after discussion on + list, and changed its API to return axes as a numpy object array + (with control of dimensions via squeeze keyword). FP. + 2010年03月13日 Manually brought in commits from branch ------------------------------------------------------------------------ Modified: trunk/matplotlib/examples/pylab_examples/fig_subplot_demo.py =================================================================== --- trunk/matplotlib/examples/pylab_examples/fig_subplot_demo.py 2010年03月20日 00:29:19 UTC (rev 8200) +++ trunk/matplotlib/examples/pylab_examples/fig_subplot_demo.py 2010年03月20日 08:57:37 UTC (rev 8201) @@ -1,32 +1,39 @@ +"""Examples illustrating the use of plt.subplots(). + +This function creates a figure and a grid of subplots with a single call, while +providing reasonable control over how the individual plots are created. For +very refined tuning of subplot creation, you can still use add_subplot() +directly on a new figure. """ -""" + import matplotlib.pyplot as plt import numpy as np +# Simple data to display in various forms x = np.linspace(0, 2*np.pi, 400) y = np.sin(x**2) plt.close('all') # Just a figure and one subplot -f, ax = plt.fig_subplot() +f, ax = plt.subplots() ax.plot(x, y) ax.set_title('Simple plot') -# Two subplots, grab the whole fig_axes list -fax = plt.fig_subplot(2, sharex=True) -fax[1].plot(x, y) -fax[1].set_title('Sharing X axis') -fax[2].scatter(x, y) +# Two subplots, the axes array is 1-d +f, axarr = plt.subplots(2, sharex=True) +axarr[0].plot(x, y) +axarr[0].set_title('Sharing X axis') +axarr[1].scatter(x, y) -# Two subplots, unpack the output immediately -f, ax1, ax2 = plt.fig_subplot(1, 2, sharey=True) +# Two subplots, unpack the axes array immediately +f, (ax1, ax2) = plt.subplots(1, 2, sharey=True) ax1.plot(x, y) ax1.set_title('Sharing Y axis') ax2.scatter(x, y) # Three subplots sharing both x/y axes -f, ax1, ax2, ax3 = plt.fig_subplot(3, sharex=True, sharey=True) +f, (ax1, ax2, ax3) = plt.subplots(3, sharex=True, sharey=True) ax1.plot(x, y) ax1.set_title('Sharing both axes') ax2.scatter(x, y) @@ -36,7 +43,21 @@ f.subplots_adjust(hspace=0) plt.setp([a.get_xticklabels() for a in f.axes[:-1]], visible=False) +# Four axes, returned as a 2-d array +f, axarr = plt.subplots(2, 2) +axarr[0,0].plot(x, y) +axarr[0,0].set_title('Axis [0,0]') +axarr[0,1].scatter(x, y) +axarr[0,1].set_title('Axis [0,1]') +axarr[1,0].plot(x, y**2) +axarr[1,0].set_title('Axis [1,0]') +axarr[1,1].scatter(x, y**2) +axarr[1,1].set_title('Axis [1,1]') +# Fine-tune figure; hide x ticks for top plots and y ticks for right plots +plt.setp([a.get_xticklabels() for a in axarr[0,:]], visible=False) +plt.setp([a.get_yticklabels() for a in axarr[:,1]], visible=False) + # Four polar axes -plt.fig_subplot(2, 2, subplot_kw=dict(polar=True)) +plt.subplots(2, 2, subplot_kw=dict(polar=True)) plt.show() Modified: trunk/matplotlib/lib/matplotlib/pyplot.py =================================================================== --- trunk/matplotlib/lib/matplotlib/pyplot.py 2010年03月20日 00:29:19 UTC (rev 8200) +++ trunk/matplotlib/lib/matplotlib/pyplot.py 2010年03月20日 08:57:37 UTC (rev 8201) @@ -79,7 +79,6 @@ new_figure_manager, draw_if_interactive, show = pylab_setup() - def findobj(o=None, match=None): if o is None: o = gcf() @@ -649,7 +648,7 @@ return a -def fig_subplot(nrows=1, ncols=1, sharex=False, sharey=False, +def subplots(nrows=1, ncols=1, sharex=False, sharey=False, squeeze=True, subplot_kw=None, **fig_kw): """Create a figure with a set of subplots already made. @@ -661,7 +660,7 @@ nrows : int Number of rows of the subplot grid. Defaults to 1. - nrows : int + ncols : int Number of columns of the subplot grid. Defaults to 1. sharex : bool @@ -670,6 +669,18 @@ sharex : bool If True, the Y axis will be shared amongst all subplots. + squeeze : bool + + If True, extra dimensions are squeezed out from the returned axis object: + - if only one subplot is constructed (nrows=ncols=1), the resulting + single Axis object is returned as a scalar. + - for Nx1 or 1xN subplots, the returned object is a 1-d numpy object + array of Axis objects are returned as numpy 1-d arrays. + - for NxM subplots with N>1 and M>1 are returned as a 2d array. + + If False, no squeezing at all is done: the returned axis object is always + a 2-d array contaning Axis instances, even if it ends up being 1x1. + subplot_kw : dict Dict with keywords passed to the add_subplot() call used to create each subplots. @@ -680,28 +691,30 @@ Returns: - fig_axes : list - A list containing [fig, ax1, ax2, ...], where fig is the Matplotlib - Figure object and the rest are the axes. - + fig, ax : tuple + - fig is the Matplotlib Figure object + - ax can be either a single axis object or an array of axis objects if + more than one supblot was created. The dimensions of the resulting array + can be controlled with the squeeze keyword, see above. + **Examples:** x = np.linspace(0, 2*np.pi, 400) y = np.sin(x**2) # Just a figure and one subplot - f, ax = plt.fig_subplot() + f, ax = plt.subplots() ax.plot(x, y) ax.set_title('Simple plot') - # Two subplots, unpack the output immediately - f, ax1, ax2 = plt.fig_subplot(1, 2, sharey=True) + # Two subplots, unpack the output array immediately + f, (ax1, ax2) = plt.subplots(1, 2, sharey=True) ax1.plot(x, y) ax1.set_title('Sharing Y axis') ax2.scatter(x, y) # Four polar axes - plt.fig_subplot(2, 2, subplot_kw=dict(polar=True)) + plt.subplots(2, 2, subplot_kw=dict(polar=True)) """ if subplot_kw is None: @@ -709,20 +722,37 @@ fig = figure(**fig_kw) + # Create empty object array to hold all axes. It's easiest to make it 1-d + # so we can just append subplots upon creation, and then + nplots = nrows*ncols + axarr = np.empty(nplots, dtype=object) + # Create first subplot separately, so we can share it if requested - ax1 = fig.add_subplot(nrows, ncols, 1, **subplot_kw) + ax0 = fig.add_subplot(nrows, ncols, 1, **subplot_kw) if sharex: - subplot_kw['sharex'] = ax1 + subplot_kw['sharex'] = ax0 if sharey: - subplot_kw['sharey'] = ax1 + subplot_kw['sharey'] = ax0 + axarr[0] = ax0 + + # Note off-by-one counting because add_subplot uses the matlab 1-based + # convention. + for i in range(1, nplots): + axarr[i] = fig.add_subplot(nrows, ncols, i+1, **subplot_kw) - # Valid indices for axes start at 1, since fig is at 0: - axes = [ fig.add_subplot(nrows, ncols, i, **subplot_kw) - for i in range(2, nrows*ncols+1)] + if squeeze: + # Reshape the array to have the final desired dimension (nrow,ncol), + # though discarding unneeded dimensions that equal 1. If we only have + # one subplot, just return it instead of a 1-element array. + if nplots==1: + return fig, axarr[0] + else: + return fig, axarr.reshape(nrows, ncols).squeeze() + else: + # returned axis array will be always 2-d, even if nrows=ncols=1 + return fig, axarr.reshape(nrows, ncols) - return [fig, ax1] + axes - def twinx(ax=None): """ Make a second axes overlay *ax* (or the current axes if *ax* is This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
Revision: 8200 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=8200&view=rev Author: heeres Date: 2010年03月20日 00:29:19 +0000 (2010年3月20日) Log Message: ----------- Add view angle patch + comment Modified Paths: -------------- trunk/matplotlib/lib/mpl_toolkits/mplot3d/axes3d.py Modified: trunk/matplotlib/lib/mpl_toolkits/mplot3d/axes3d.py =================================================================== --- trunk/matplotlib/lib/mpl_toolkits/mplot3d/axes3d.py 2010年03月19日 17:12:41 UTC (rev 8199) +++ trunk/matplotlib/lib/mpl_toolkits/mplot3d/axes3d.py 2010年03月20日 00:29:19 UTC (rev 8200) @@ -59,16 +59,16 @@ self.fig = fig self._cids = [] - azim = kwargs.pop('azim', -60) - elev = kwargs.pop('elev', 30) + self.initial_azim = kwargs.pop('azim', -60) + self.initial_elev = kwargs.pop('elev', 30) self.xy_viewLim = unit_bbox() self.zz_viewLim = unit_bbox() self.xy_dataLim = unit_bbox() self.zz_dataLim = unit_bbox() - # inihibit autoscale_view until the axises are defined + # inihibit autoscale_view until the axes are defined # they can't be defined until Axes.__init__ has been called - self.view_init(elev, azim) + self.view_init(self.initial_elev, self.initial_azim) self._ready = 0 Axes.__init__(self, self.fig, rect, frameon=True, @@ -272,11 +272,31 @@ def panpy(self, numsteps): print 'numsteps', numsteps - def view_init(self, elev, azim): + def view_init(self, elev=None, azim=None): + """ + Set the elevation and azimuth of the axes. + + This can be used to rotate the axes programatically. + + 'elev' stores the elevation angle in the z plane. + 'azim' stores the azimuth angle in the x,y plane. + + if elev or azim are None (default), then the initial value + is used which was specified in the :class:`Axes3D` constructor. + """ + self.dist = 10 - self.elev = elev - self.azim = azim - + + if elev is None: + self.elev = self.initial_elev + else: + self.elev = elev + + if azim is None: + self.azim = self.initial_azim + else: + self.azim = azim + def get_proj(self): """Create the projection matrix from the current viewing position. This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
Revision: 8199 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=8199&view=rev Author: heeres Date: 2010年03月19日 17:12:41 +0000 (2010年3月19日) Log Message: ----------- Some fixes Modified Paths: -------------- trunk/matplotlib/examples/mplot3d/hist3d_demo.py trunk/matplotlib/examples/mplot3d/text3d_demo.py trunk/matplotlib/lib/mpl_toolkits/mplot3d/art3d.py trunk/matplotlib/lib/mpl_toolkits/mplot3d/axes3d.py Modified: trunk/matplotlib/examples/mplot3d/hist3d_demo.py =================================================================== --- trunk/matplotlib/examples/mplot3d/hist3d_demo.py 2010年03月19日 16:50:37 UTC (rev 8198) +++ trunk/matplotlib/examples/mplot3d/hist3d_demo.py 2010年03月19日 17:12:41 UTC (rev 8199) @@ -17,7 +17,7 @@ dy = dx.copy() dz = hist.flatten() -ax.bar3d(xpos, ypos, zpos, dx, dy, dz, color='b') +ax.bar3d(xpos, ypos, zpos, dx, dy, dz, color='b', zsort='average') plt.show() Modified: trunk/matplotlib/examples/mplot3d/text3d_demo.py =================================================================== --- trunk/matplotlib/examples/mplot3d/text3d_demo.py 2010年03月19日 16:50:37 UTC (rev 8198) +++ trunk/matplotlib/examples/mplot3d/text3d_demo.py 2010年03月19日 17:12:41 UTC (rev 8199) @@ -13,6 +13,9 @@ label = '(%d, %d, %d), dir=%s' % (x, y, z, zdir) ax.text(x, y, z, label, zdir) +ax.text(1, 1, 1, "red", color='red') +ax.text2D(0.05, 0.95, "2D Text", transform=ax.transAxes) + ax.set_xlim3d(0, 10) ax.set_ylim3d(0, 10) ax.set_zlim3d(0, 10) Modified: trunk/matplotlib/lib/mpl_toolkits/mplot3d/art3d.py =================================================================== --- trunk/matplotlib/lib/mpl_toolkits/mplot3d/art3d.py 2010年03月19日 16:50:37 UTC (rev 8198) +++ trunk/matplotlib/lib/mpl_toolkits/mplot3d/art3d.py 2010年03月19日 17:12:41 UTC (rev 8199) @@ -1,6 +1,7 @@ #!/usr/bin/python # art3d.py, original mplot3d version by John Porter # Parts rewritten by Reinier Heeres <re...@he...> +# Minor additions by Ben Axelrod <bax...@co...> ''' Module containing 3D artist code and functions to convert 2D @@ -15,6 +16,7 @@ from matplotlib.colors import Normalize from matplotlib.cbook import iterable +import warnings import numpy as np import math import proj3d @@ -52,8 +54,15 @@ Text object with 3D position and (in the future) direction. ''' - def __init__(self, x=0, y=0, z=0, text='', zdir='z'): - mtext.Text.__init__(self, x, y, text) + def __init__(self, x=0, y=0, z=0, text='', zdir='z', **kwargs): + ''' + *x*, *y*, *z* Position of text + *text* Text string to display + *zdir* Direction of text + + Keyword arguments are passed onto :func:`~matplotlib.text.Text`. + ''' + mtext.Text.__init__(self, x, y, text, **kwargs) self.set_3d_properties(z, zdir) def set_3d_properties(self, z=0, zdir='z'): @@ -86,6 +95,9 @@ ''' def __init__(self, xs, ys, zs, *args, **kwargs): + ''' + Keyword arguments are passed onto :func:`~matplotlib.lines.Line2D`. + ''' lines.Line2D.__init__(self, [], [], *args, **kwargs) self._verts3d = xs, ys, zs @@ -145,6 +157,9 @@ ''' def __init__(self, segments, *args, **kwargs): + ''' + Keyword arguments are passed onto :func:`~matplotlib.collections.LineCollection`. + ''' LineCollection.__init__(self, segments, *args, **kwargs) def set_segments(self, segments): @@ -317,13 +332,44 @@ *verts* should contain 3D coordinates. + Keyword arguments: + zsort, see set_zsort for options. + Note that this class does a bit of magic with the _facecolors and _edgecolors properties. ''' + self.set_zsort(kwargs.pop('zsort', True)) + PolyCollection.__init__(self, verts, *args, **kwargs) - self._zsort = 1 + + _zsort_functions = { + 'average': np.average, + 'min': np.min, + 'max': np.max, + } + + def set_zsort(self, zsort): + ''' + Set z-sorting behaviour: + boolean: if True use default 'average' + string: 'average', 'min' or 'max' + ''' + + if zsort is True: + zsort = 'average' + + if zsort is not False: + if zsort in self._zsort_functions: + zsortfunc = self._zsort_functions[zsort] + else: + return False + else: + zsortfunc = None + + self._zsort = zsort self._sort_zpos = None + self._zsortfunc = zsortfunc def get_vector(self, segments3d): """Optimize points for projection""" @@ -348,12 +394,13 @@ PolyCollection.set_verts(self, [], closed) def set_3d_properties(self): - self._zsort = 1 self._sort_zpos = None + self.set_zsort(True) self._facecolors3d = PolyCollection.get_facecolors(self) self._edgecolors3d = PolyCollection.get_edgecolors(self) - def set_sort_zpos(self, val): + def set_sort_zpos(self,val): + '''Set the position to use for z-sorting.''' self._sort_zpos = val def do_3d_projection(self, renderer): @@ -381,7 +428,7 @@ # if required sort by depth (furthest drawn first) if self._zsort: - z_segments_2d = [(np.average(zs), zip(xs, ys), fc, ec) for + z_segments_2d = [(self._zsortfunc(zs), zip(xs, ys), fc, ec) for (xs, ys, zs), fc, ec in zip(xyzlist, cface, cedge)] z_segments_2d.sort(cmp=lambda x, y: cmp(y[0], x[0])) else: @@ -468,9 +515,14 @@ def iscolor(c): try: - return (len(c) == 4 or len(c) == 3) and hasattr(c[0], '__float__') - except (IndexError): + if len(c) == 4 or len(c) == 3: + if iterable(c[0]): + return False + if hasattr(c[0], '__float__'): + return True + except: return False + return False def get_colors(c, num): """Stretch the color argument to provide the required number num""" @@ -484,6 +536,8 @@ return c elif iscolor(c): return [c] * num + elif len(c) == 0: #if edgecolor or facecolor is specified as 'none' + return [[0,0,0,0]] * num elif iscolor(c[0]): return [c[0]] * num else: Modified: trunk/matplotlib/lib/mpl_toolkits/mplot3d/axes3d.py =================================================================== --- trunk/matplotlib/lib/mpl_toolkits/mplot3d/axes3d.py 2010年03月19日 16:50:37 UTC (rev 8198) +++ trunk/matplotlib/lib/mpl_toolkits/mplot3d/axes3d.py 2010年03月19日 17:12:41 UTC (rev 8199) @@ -2,12 +2,14 @@ # axes3d.py, original mplot3d version by John Porter # Created: 23 Sep 2005 # Parts fixed by Reinier Heeres <re...@he...> +# Minor additions by Ben Axelrod <bax...@co...> """ Module containing Axes3D, an object which can plot 3D objects on a 2D matplotlib figure. """ +import warnings from matplotlib.axes import Axes, rcParams from matplotlib import cbook from matplotlib.transforms import Bbox @@ -55,7 +57,7 @@ if rect is None: rect = [0.0, 0.0, 1.0, 1.0] self.fig = fig - self.cids = [] + self._cids = [] azim = kwargs.pop('azim', -60) elev = kwargs.pop('elev', 30) @@ -147,7 +149,7 @@ # Calculate projection of collections and zorder them zlist = [(col.do_3d_projection(renderer), col) \ - for col in self.collections] + for col in self.collections] zlist.sort() zlist.reverse() for i, (z, col) in enumerate(zlist): @@ -322,23 +324,52 @@ M = np.dot(perspM, M0) return M - def mouse_init(self): + def mouse_init(self, rotate_btn=1, zoom_btn=3): + """Initializes mouse button callbacks to enable 3D rotation of + the axes. Also optionally sets the mouse buttons for 3D rotation + and zooming. + + ============ ================================================ + Argument Description + ============ ================================================ + *rotate_btn* The integer or list of integers specifying which mouse + button or buttons to use for 3D rotation of the axes. + Default = 1. + + *zoom_btn* The integer or list of integers specifying which mouse + button or buttons to use to zoom the 3D axes. + Default = 3. + ============ ================================================ + """ self.button_pressed = None canv = self.figure.canvas if canv != None: c1 = canv.mpl_connect('motion_notify_event', self._on_move) c2 = canv.mpl_connect('button_press_event', self._button_press) c3 = canv.mpl_connect('button_release_event', self._button_release) - self.cids = [c1, c2, c3] + self._cids = [c1, c2, c3] + else: + warnings.warn('Axes3D.figure.canvas is \'None\', mouse rotation disabled. Set canvas then call Axes3D.mouse_init().') + self._rotate_btn = np.atleast_1d(rotate_btn) + self._zoom_btn = np.atleast_1d(zoom_btn) + def cla(self): - # Disconnect the various events we set. - for cid in self.cids: - self.figure.canvas.mpl_disconnect(cid) - self.cids = [] + """Clear axes and disable mouse button callbacks. + """ + self.disable_mouse_rotation() Axes.cla(self) self.grid(rcParams['axes3d.grid']) + def disable_mouse_rotation(self): + """Disable mouse button callbacks. + """ + # Disconnect the various events we set. + for cid in self._cids: + self.figure.canvas.mpl_disconnect(cid) + + self._cids = [] + def _button_press(self, event): if event.inaxes == self: self.button_pressed = event.button @@ -426,9 +457,10 @@ def _on_move(self, event): """Mouse moving - button-1 rotates - button-3 zooms + button-1 rotates by default. Can be set explicitly in mouse_init(). + button-3 zooms by default. Can be set explicitly in mouse_init(). """ + if not self.button_pressed: return @@ -447,7 +479,8 @@ h = (y1-y0) self.sx, self.sy = x, y - if self.button_pressed == 1: + # Rotation + if self.button_pressed in self._rotate_btn: # rotate viewing point # get the x and y pixel coords if dx == 0 and dy == 0: @@ -456,12 +489,15 @@ self.azim = art3d.norm_angle(self.azim - (dx/w)*180) self.get_proj() self.figure.canvas.draw() - elif self.button_pressed == 2: + +# elif self.button_pressed == 2: # pan view # project xv,yv,zv -> xw,yw,zw # pan - pass - elif self.button_pressed == 3: +# pass + + # Zoom + elif self.button_pressed in self._zoom_btn: # zoom view # hmmm..this needs some help from clipping.... minx, maxx, miny, maxy, minz, maxz = self.get_w_lims() @@ -476,7 +512,7 @@ self.figure.canvas.draw() def set_xlabel(self, xlabel, fontdict=None, **kwargs): - '''Set xlabel. ''' + '''Set xlabel.''' label = self.w_xaxis.get_label() label.set_text(xlabel) @@ -511,13 +547,18 @@ ''' self._draw_grid = on - def text(self, x, y, z, s, zdir=None): - '''Add text to the plot.''' - text = Axes.text(self, x, y, s) + def text(self, x, y, z, s, zdir=None, **kwargs): + ''' + Add text to the plot. kwargs will be passed on to Axes.text, + except for the `zdir` keyword, which sets the direction to be + used as the z direction. + ''' + text = Axes.text(self, x, y, s, **kwargs) art3d.text_2d_to_3d(text, z, zdir) return text text3D = text + text2D = Axes.text def plot(self, xs, ys, *args, **kwargs): ''' @@ -591,6 +632,9 @@ *shade* Whether to shade the facecolors, default: false when cmap specified, true otherwise ========== ================================================ + + Other arguments are passed on to + :func:`~mpl_toolkits.mplot3d.art3d.Poly3DCollection.__init__` ''' had_data = self.has_data() @@ -822,8 +866,9 @@ colors = self._shade_colors(color, normals) colors2 = self._shade_colors(color, normals) - polycol = art3d.Poly3DCollection(polyverts, facecolors=colors, - edgecolors=colors2) + polycol = art3d.Poly3DCollection(polyverts, + facecolors=colors, + edgecolors=colors2) polycol.set_sort_zpos(z) self.add_collection3d(polycol) @@ -848,6 +893,8 @@ Other keyword arguments are passed on to :func:`~matplotlib.axes.Axes.contour` + + Returns a :class:`~matplotlib.axes.Axes.contour` ''' extend3d = kwargs.pop('extend3d', False) @@ -881,7 +928,9 @@ *X*, *Y*, *Z*: data points. Keyword arguments are passed on to - :func:`~matplotlib.axes.Axes.contour` + :func:`~matplotlib.axes.Axes.contourf` + + Returns a :class:`~matplotlib.axes.Axes.contourf` ''' had_data = self.has_data() @@ -1005,25 +1054,61 @@ return patches - def bar3d(self, x, y, z, dx, dy, dz, color='b'): + def bar3d(self, x, y, z, dx, dy, dz, color='b', + zsort='average', *args, **kwargs): ''' Generate a 3D bar, or multiple bars. When generating multiple bars, x, y, z have to be arrays. - dx, dy, dz can still be scalars. + dx, dy, dz can be arrays or scalars. + + *color* can be: + - A single color value, to color all bars the same color. + - An array of colors of length N bars, to color each bar + independently. + - An array of colors of length 6, to color the faces of the bars + similarly. + - An array of colors of length 6 * N bars, to color each face + independently. + + When coloring the faces of the boxes specifically, this is the order + of the coloring: + 1. -Z (bottom of box) + 2. +Z (top of box) + 3. -Y + 4. +Y + 5. -X + 6. +X + + Keyword arguments are passed onto + :func:`~mpl_toolkits.mplot3d.art3d.Poly3DCollection` ''' - had_data = self.has_data() if not cbook.iterable(x): - x, y, z = [x], [y], [z] + x = [x] + if not cbook.iterable(y): + y = [y] + if not cbook.iterable(z): + z = [z] + if not cbook.iterable(dx): - dx, dy, dz = [dx], [dy], [dz] + dx = [dx] + if not cbook.iterable(dy): + dy = [dy] + if not cbook.iterable(dz): + dz = [dz] + if len(dx) == 1: dx = dx * len(x) - dy = dy * len(x) - dz = dz * len(x) + if len(dy) == 1: + dy = dy * len(y) + if len(dz) == 1: + dz = dz * len(z) + if len(x) != len(y) or len(x) != len(z): + warnings.warn('x, y, and z must be the same length.') + minx, miny, minz = 1e20, 1e20, 1e20 maxx, maxy, maxz = -1e20, -1e20, -1e20 @@ -1053,15 +1138,35 @@ (xi + dxi, yi + dyi, zi + dzi), (xi + dxi, yi, zi + dzi)), ]) - color = np.array(colorConverter.to_rgba(color)) + facecolors = [] + if color is None: + # no color specified + facecolors = [None] * len(x) + elif len(color) == len(x): + # bar colors specified, need to expand to number of faces + for c in color: + facecolors.extend([c] * 6) + else: + # a single color specified, or face colors specified explicitly + facecolors = list(colorConverter.to_rgba_array(color)) + if len(facecolors) < len(x): + facecolors *= (6 * len(x)) + normals = self._generate_normals(polys) - colors = self._shade_colors(color, normals) - - col = art3d.Poly3DCollection(polys, facecolor=colors) + sfacecolors = self._shade_colors(facecolors, normals) + col = art3d.Poly3DCollection(polys, + zsort=zsort, + facecolor=sfacecolors, + *args, **kwargs) self.add_collection(col) self.auto_scale_xyz((minx, maxx), (miny, maxy), (minz, maxz), had_data) + def set_title(self, label, fontdict=None, **kwargs): + Axes.set_title(self, label, fontdict, **kwargs) + (x, y) = self.title.get_position() + self.title.set_y(0.92 * y) + def get_test_data(delta=0.05): ''' Return a tuple X, Y, Z with a test data set. This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
Revision: 8198 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=8198&view=rev Author: heeres Date: 2010年03月19日 16:50:37 +0000 (2010年3月19日) Log Message: ----------- Add 3d surface plot example (radial coordinates) Added Paths: ----------- trunk/matplotlib/examples/mplot3d/surface3d_radial_demo.py Added: trunk/matplotlib/examples/mplot3d/surface3d_radial_demo.py =================================================================== --- trunk/matplotlib/examples/mplot3d/surface3d_radial_demo.py (rev 0) +++ trunk/matplotlib/examples/mplot3d/surface3d_radial_demo.py 2010年03月19日 16:50:37 UTC (rev 8198) @@ -0,0 +1,27 @@ +# By Armin Moser + +from mpl_toolkits.mplot3d import Axes3D +import matplotlib +import numpy as np +from matplotlib import cm +from matplotlib import pyplot as plt +step = 0.04 +maxval = 1.0 +fig = plt.figure() +ax = Axes3D(fig) + +# create supporting points in polar coordinates +r = np.linspace(0,1.25,50) +p = np.linspace(0,2*np.pi,50) +R,P = np.meshgrid(r,p) +# transform them to cartesian system +X,Y = R*np.cos(P),R*np.sin(P) + +Z = ((R**2 - 1)**2) +ax.plot_surface(X, Y, Z, rstride=1, cstride=1, cmap=cm.jet) +ax.set_zlim3d(0, 1) +ax.set_xlabel(r'$\phi_\mathrm{real}$') +ax.set_ylabel(r'$\phi_\mathrm{im}$') +ax.set_zlabel(r'$V(\phi)$') +ax.set_xticks([]) +plt.show() This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
Revision: 8197 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=8197&view=rev Author: heeres Date: 2010年03月19日 16:49:29 +0000 (2010年3月19日) Log Message: ----------- Add 3d surface plot example (radial coordinates) Added Paths: ----------- branches/v0_99_maint/examples/mplot3d/surface3d_radial_demo.py Added: branches/v0_99_maint/examples/mplot3d/surface3d_radial_demo.py =================================================================== --- branches/v0_99_maint/examples/mplot3d/surface3d_radial_demo.py (rev 0) +++ branches/v0_99_maint/examples/mplot3d/surface3d_radial_demo.py 2010年03月19日 16:49:29 UTC (rev 8197) @@ -0,0 +1,27 @@ +# By Armin Moser + +from mpl_toolkits.mplot3d import Axes3D +import matplotlib +import numpy as np +from matplotlib import cm +from matplotlib import pyplot as plt +step = 0.04 +maxval = 1.0 +fig = plt.figure() +ax = Axes3D(fig) + +# create supporting points in polar coordinates +r = np.linspace(0,1.25,50) +p = np.linspace(0,2*np.pi,50) +R,P = np.meshgrid(r,p) +# transform them to cartesian system +X,Y = R*np.cos(P),R*np.sin(P) + +Z = ((R**2 - 1)**2) +ax.plot_surface(X, Y, Z, rstride=1, cstride=1, cmap=cm.jet) +ax.set_zlim3d(0, 1) +ax.set_xlabel(r'$\phi_\mathrm{real}$') +ax.set_ylabel(r'$\phi_\mathrm{im}$') +ax.set_zlabel(r'$V(\phi)$') +ax.set_xticks([]) +plt.show() This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
Revision: 8196 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=8196&view=rev Author: efiring Date: 2010年03月16日 00:56:09 +0000 (2010年3月16日) Log Message: ----------- patches.py: correct docstring in set_color Modified Paths: -------------- trunk/matplotlib/lib/matplotlib/patches.py Modified: trunk/matplotlib/lib/matplotlib/patches.py =================================================================== --- trunk/matplotlib/lib/matplotlib/patches.py 2010年03月16日 00:55:20 UTC (rev 8195) +++ trunk/matplotlib/lib/matplotlib/patches.py 2010年03月16日 00:56:09 UTC (rev 8196) @@ -246,7 +246,7 @@ """ Set both the edgecolor and the facecolor. - ACCEPTS: matplotlib color arg or sequence of rgba tuples + ACCEPTS: matplotlib color spec .. seealso:: This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
Revision: 8195 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=8195&view=rev Author: efiring Date: 2010年03月16日 00:55:20 +0000 (2010年3月16日) Log Message: ----------- patches.py: correct docstring in set_color Modified Paths: -------------- branches/v0_99_maint/lib/matplotlib/patches.py Modified: branches/v0_99_maint/lib/matplotlib/patches.py =================================================================== --- branches/v0_99_maint/lib/matplotlib/patches.py 2010年03月15日 20:34:32 UTC (rev 8194) +++ branches/v0_99_maint/lib/matplotlib/patches.py 2010年03月16日 00:55:20 UTC (rev 8195) @@ -203,7 +203,7 @@ """ Set both the edgecolor and the facecolor. - ACCEPTS: matplotlib color arg or sequence of rgba tuples + ACCEPTS: matplotlib color spec .. seealso:: This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
Revision: 8194 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=8194&view=rev Author: jdh2358 Date: 2010年03月15日 20:34:32 +0000 (2010年3月15日) Log Message: ----------- fix ticker docstring bug Modified Paths: -------------- trunk/matplotlib/lib/matplotlib/ticker.py Modified: trunk/matplotlib/lib/matplotlib/ticker.py =================================================================== --- trunk/matplotlib/lib/matplotlib/ticker.py 2010年03月15日 20:33:40 UTC (rev 8193) +++ trunk/matplotlib/lib/matplotlib/ticker.py 2010年03月15日 20:34:32 UTC (rev 8194) @@ -358,7 +358,7 @@ ''' Sets size thresholds for scientific notation. - e.g. ``xaxis.set_powerlimits((-3, 4))`` sets the pre-2007 default in + e.g. ``formatter.set_powerlimits((-3, 4))`` sets the pre-2007 default in which scientific notation is used for numbers less than 1e-3 or greater than 1e4. See also :meth:`set_scientific`. This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
Revision: 8193 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=8193&view=rev Author: jdh2358 Date: 2010年03月15日 20:33:40 +0000 (2010年3月15日) Log Message: ----------- fix ticker docstring bug Modified Paths: -------------- branches/v0_99_maint/lib/matplotlib/ticker.py Modified: branches/v0_99_maint/lib/matplotlib/ticker.py =================================================================== --- branches/v0_99_maint/lib/matplotlib/ticker.py 2010年03月13日 22:31:11 UTC (rev 8192) +++ branches/v0_99_maint/lib/matplotlib/ticker.py 2010年03月15日 20:33:40 UTC (rev 8193) @@ -355,7 +355,7 @@ ''' Sets size thresholds for scientific notation. - e.g. ``xaxis.set_powerlimits((-3, 4))`` sets the pre-2007 default in + e.g. ``formatter.set_powerlimits((-3, 4))`` sets the pre-2007 default in which scientific notation is used for numbers less than 1e-3 or greater than 1e4. See also :meth:`set_scientific`. This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
Revision: 8192 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=8192&view=rev Author: leejjoon Date: 2010年03月13日 22:31:11 +0000 (2010年3月13日) Log Message: ----------- fix the bug that handles for scatter are incorrectly set when dpi!=72. Thanks to Ray Speth for the bug report. Modified Paths: -------------- trunk/matplotlib/CHANGELOG trunk/matplotlib/lib/matplotlib/legend.py Modified: trunk/matplotlib/CHANGELOG =================================================================== --- trunk/matplotlib/CHANGELOG 2010年03月13日 22:27:57 UTC (rev 8191) +++ trunk/matplotlib/CHANGELOG 2010年03月13日 22:31:11 UTC (rev 8192) @@ -1,3 +1,11 @@ +2010年03月13日 Manually brought in commits from branch + + ------------------------------------------------------------------------ + r8191 | leejjoon | 2010年03月13日 17:27:57 -0500 (2010年3月13日) | 1 line + + fix the bug that handles for scatter are incorrectly set when dpi!=72. Thanks to Ray Speth for the bug report. + + 2010年03月03日 Manually brought in commits from branch via diff/patch (svnmerge is broken) ------------------------------------------------------------------------ Modified: trunk/matplotlib/lib/matplotlib/legend.py =================================================================== --- trunk/matplotlib/lib/matplotlib/legend.py 2010年03月13日 22:27:57 UTC (rev 8191) +++ trunk/matplotlib/lib/matplotlib/legend.py 2010年03月13日 22:31:11 UTC (rev 8192) @@ -623,6 +623,14 @@ xdescent=0., ydescent=descent) handlebox.add_artist(handle) + + # special case for collection instances + if isinstance(handle, RegularPolyCollection) or \ + isinstance(handle, CircleCollection): + handle._transOffset = handlebox.get_transform() + handle.set_transform(None) + + if hasattr(handle, "_legmarker"): handlebox.add_artist(handle._legmarker) handleboxes.append(handlebox) This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
Revision: 8191 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=8191&view=rev Author: leejjoon Date: 2010年03月13日 22:27:57 +0000 (2010年3月13日) Log Message: ----------- fix the bug that handles for scatter are incorrectly set when dpi!=72. Thanks to Ray Speth for the bug report. Modified Paths: -------------- branches/v0_99_maint/CHANGELOG branches/v0_99_maint/lib/matplotlib/legend.py Modified: branches/v0_99_maint/CHANGELOG =================================================================== --- branches/v0_99_maint/CHANGELOG 2010年03月13日 19:27:00 UTC (rev 8190) +++ branches/v0_99_maint/CHANGELOG 2010年03月13日 22:27:57 UTC (rev 8191) @@ -1,3 +1,6 @@ +2010年03月13日 fix the bug that handles for scatter are incorrectly set when + dpi!=72. Thanks to Ray Speth for the bug report. -JJL + =============================================== 2009年09月21日 Tagged for release 0.99.1 Modified: branches/v0_99_maint/lib/matplotlib/legend.py =================================================================== --- branches/v0_99_maint/lib/matplotlib/legend.py 2010年03月13日 19:27:00 UTC (rev 8190) +++ branches/v0_99_maint/lib/matplotlib/legend.py 2010年03月13日 22:27:57 UTC (rev 8191) @@ -580,6 +580,13 @@ handle = handle_list[-1] handlebox.add_artist(handle) + + # special case for collection instances + if isinstance(handle, RegularPolyCollection) or \ + isinstance(handle, CircleCollection): + handle._transOffset = handlebox.get_transform() + handle.set_transform(None) + if hasattr(handle, "_legmarker"): handlebox.add_artist(handle._legmarker) handleboxes.append(handlebox) This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
Revision: 8190 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=8190&view=rev Author: efiring Date: 2010年03月13日 19:27:00 +0000 (2010年3月13日) Log Message: ----------- contour: autolev drops line contour levels only if outside data range Modified Paths: -------------- trunk/matplotlib/lib/matplotlib/contour.py Modified: trunk/matplotlib/lib/matplotlib/contour.py =================================================================== --- trunk/matplotlib/lib/matplotlib/contour.py 2010年03月12日 23:23:49 UTC (rev 8189) +++ trunk/matplotlib/lib/matplotlib/contour.py 2010年03月13日 19:27:00 UTC (rev 8190) @@ -775,7 +775,8 @@ self._auto = True if self.filled: return lev - return lev[1:-1] + # For line contours, drop levels outside the data range. + return lev[(lev > zmin) & (lev < zmax)] def _initialize_x_y(self, z): ''' This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.