From: <jd...@us...> - 2008-12-10 16:39:06
|
Revision: 6550 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=6550&view=rev Author: jdh2358 Date: 2008-12-10 16:39:01 +0000 (Wed, 10 Dec 2008) Log Message: ----------- updates to doc Modified Paths: -------------- trunk/matplotlib/doc/api/artist_api.rst trunk/matplotlib/doc/devel/coding_guide.rst trunk/matplotlib/doc/users/whats_new.rst trunk/matplotlib/examples/pylab_examples/psd_demo2.py trunk/matplotlib/examples/pylab_examples/psd_demo3.py trunk/matplotlib/lib/matplotlib/axes.py trunk/matplotlib/lib/matplotlib/legend.py trunk/matplotlib/lib/matplotlib/patches.py Added Paths: ----------- trunk/matplotlib/doc/pyplots/whats_new_98_4_fancy.py trunk/matplotlib/doc/pyplots/whats_new_98_4_fill_between.py trunk/matplotlib/doc/pyplots/whats_new_98_4_legend.py Modified: trunk/matplotlib/doc/api/artist_api.rst =================================================================== --- trunk/matplotlib/doc/api/artist_api.rst 2008-12-10 15:22:03 UTC (rev 6549) +++ trunk/matplotlib/doc/api/artist_api.rst 2008-12-10 16:39:01 UTC (rev 6550) @@ -15,6 +15,14 @@ :undoc-members: :show-inheritance: +:mod:`matplotlib.legend` +============================= + +.. automodule:: matplotlib.legend + :members: + :undoc-members: + :show-inheritance: + :mod:`matplotlib.lines` ============================= Modified: trunk/matplotlib/doc/devel/coding_guide.rst =================================================================== --- trunk/matplotlib/doc/devel/coding_guide.rst 2008-12-10 15:22:03 UTC (rev 6549) +++ trunk/matplotlib/doc/devel/coding_guide.rst 2008-12-10 16:39:01 UTC (rev 6550) @@ -27,6 +27,12 @@ svn co https://matplotlib.svn.sourceforge.net/svnroot/matplotlib/branches/\ v0_91_maint mpl91 --username=youruser --password=yourpass +The current release of the trunk is in the 0.98.4 maintenance branch:: + + svn co https://matplotlib.svn.sourceforge.net/svnroot/matplotlib/branches/\ + v0_98_4_maint mpl98.4 --username=youruser --password=yourpass + + Committing changes ------------------ Added: trunk/matplotlib/doc/pyplots/whats_new_98_4_fancy.py =================================================================== --- trunk/matplotlib/doc/pyplots/whats_new_98_4_fancy.py (rev 0) +++ trunk/matplotlib/doc/pyplots/whats_new_98_4_fancy.py 2008-12-10 16:39:01 UTC (rev 6550) @@ -0,0 +1,54 @@ +import matplotlib.patches as mpatch +import matplotlib.pyplot as plt + +figheight = 8 +fig = plt.figure(1, figsize=(9, figheight), dpi=80) +fontsize = 0.4 * fig.dpi + +def make_boxstyles(ax): + styles = mpatch.BoxStyle.get_styles() + + for i, (stylename, styleclass) in enumerate(styles.items()): + ax.text(0.5, (float(len(styles)) - 0.5 - i)/len(styles), stylename, + ha="center", + size=fontsize, + transform=ax.transAxes, + bbox=dict(boxstyle=stylename, fc="w", ec="k")) + +def make_arrowstyles(ax): + styles = mpatch.ArrowStyle.get_styles() + + ax.set_xlim(0, 4) + ax.set_ylim(0, figheight) + + for i, (stylename, styleclass) in enumerate(sorted(styles.items())): + y = (float(len(styles)) -0.25 - i) # /figheight + p = mpatch.Circle((3.2, y), 0.2, fc="w") + ax.add_patch(p) + + ax.annotate(stylename, (3.2, y), + (2., y), + #xycoords="figure fraction", textcoords="figure fraction", + ha="right", va="center", + size=fontsize, + arrowprops=dict(arrowstyle=stylename, + patchB=p, + shrinkA=5, + shrinkB=5, + fc="w", ec="k", + connectionstyle="arc3,rad=-0.05", + ), + bbox=dict(boxstyle="square", fc="w")) + + ax.xaxis.set_visible(False) + ax.yaxis.set_visible(False) + + +ax1 = fig.add_subplot(121, frameon=False, xticks=[], yticks=[]) +make_boxstyles(ax1) + +ax2 = fig.add_subplot(122, frameon=False, xticks=[], yticks=[]) +make_arrowstyles(ax2) + + +plt.show() Added: trunk/matplotlib/doc/pyplots/whats_new_98_4_fill_between.py =================================================================== --- trunk/matplotlib/doc/pyplots/whats_new_98_4_fill_between.py (rev 0) +++ trunk/matplotlib/doc/pyplots/whats_new_98_4_fill_between.py 2008-12-10 16:39:01 UTC (rev 6550) @@ -0,0 +1,17 @@ +#!/usr/bin/env python +import matplotlib.mlab as mlab +from pylab import figure, show +import numpy as np + +x = np.arange(0.0, 2, 0.01) +y1 = np.sin(2*np.pi*x) +y2 = 1.2*np.sin(4*np.pi*x) + +fig = figure() +ax = fig.add_subplot(111) +ax.plot(x, y1, x, y2, color='black') +ax.fill_between(x, y1, y2, where=y2>y1, facecolor='green') +ax.fill_between(x, y1, y2, where=y2<=y1, facecolor='red') +ax.set_title('fill between where') + +show() Added: trunk/matplotlib/doc/pyplots/whats_new_98_4_legend.py =================================================================== --- trunk/matplotlib/doc/pyplots/whats_new_98_4_legend.py (rev 0) +++ trunk/matplotlib/doc/pyplots/whats_new_98_4_legend.py 2008-12-10 16:39:01 UTC (rev 6550) @@ -0,0 +1,18 @@ +import matplotlib.pyplot as plt +import numpy as np +import matplotlib.pyplot as plt + + +ax = plt.subplot(111) +t1 = np.arange(0.0, 1.0, 0.1) +for n in [1, 2, 3, 4]: + plt.plot(t1, t1**n, label="n=%d"%(n,)) + +leg = plt.legend(loc='best', ncol=4, mode="expand", shadow=True, fancybox=True) +leg.get_frame().set_alpha(0.7) + + +plt.show() + + + Modified: trunk/matplotlib/doc/users/whats_new.rst =================================================================== --- trunk/matplotlib/doc/users/whats_new.rst 2008-12-10 15:22:03 UTC (rev 6549) +++ trunk/matplotlib/doc/users/whats_new.rst 2008-12-10 16:39:01 UTC (rev 6550) @@ -19,8 +19,10 @@ Jae-Joon has rewritten the legend class, and added support for multiple columns and rows, as well as fancy box drawing. See -:ref:`pylab_examples-legend_demo3`. +:func:`~matplotlib.pyplot.legend` and +:class:`matplotlib.legend.Legend`. +.. plot:: pyplots/whats_new_98_4_legend.py .. _fancy-annotations: @@ -29,9 +31,13 @@ Jae-Joon has added lot's of support to annotations for drawing fancy boxes and connectors in annotations. See -:ref:`pylab_examples-annotation_demo2` and -:ref:`pylab_examples-fancyarrow_demo`. +:func:`~matplotlib.pyplot.annotate` and +:class:`~matplotlib.patches.BoxStyle`, +:class:`~matplotlib.patches.ArrowStyle`, and +:class:`~matplotlib.patches.ConnectionStyle`. +.. plot:: pyplots/whats_new_98_4_fancy.py + .. _psd-amplitude: psd amplitude scaling @@ -49,9 +55,13 @@ ------------------ Added a :func:`~matplotlib.pyplot.fill_between` function to make it -easier to do shaded region plots in the presence of masked data. See -:ref:`pylab_examples-fill_between`. +easier to do shaded region plots in the presence of masked data. You +can pass an *x* array and a *ylower* and *yupper* array to fill +betweem, and an optional *where* argument which is a logical mask +where you want to do the filling. +.. plot:: pyplots/whats_new_98_4_fill_between.py + Lots more ----------- Modified: trunk/matplotlib/examples/pylab_examples/psd_demo2.py =================================================================== --- trunk/matplotlib/examples/pylab_examples/psd_demo2.py 2008-12-10 15:22:03 UTC (rev 6549) +++ trunk/matplotlib/examples/pylab_examples/psd_demo2.py 2008-12-10 16:39:01 UTC (rev 6550) @@ -10,6 +10,7 @@ #Plot the raw time series fig = plt.figure() +fig.subplots_adjust(hspace=0.45, wspace=0.3) ax = fig.add_subplot(2, 1, 1) ax.plot(t, y) @@ -19,7 +20,7 @@ ax2.psd(y, NFFT=len(t), pad_to=len(t), Fs=fs) ax2.psd(y, NFFT=len(t), pad_to=len(t)*2, Fs=fs) ax2.psd(y, NFFT=len(t), pad_to=len(t)*4, Fs=fs) -plt.title('Effect of zero padding') +plt.title('zero padding') #Plot the PSD with different block sizes, Zero pad to the length of the orignal #data sequence. @@ -27,13 +28,15 @@ ax3.psd(y, NFFT=len(t), pad_to=len(t), Fs=fs) ax3.psd(y, NFFT=len(t)//2, pad_to=len(t), Fs=fs) ax3.psd(y, NFFT=len(t)//4, pad_to=len(t), Fs=fs) -plt.title('Effect of block size') +ax3.set_ylabel('') +plt.title('block size') #Plot the PSD with different amounts of overlap between blocks ax4 = fig.add_subplot(2, 3, 6, sharex=ax2, sharey=ax2) ax4.psd(y, NFFT=len(t)//2, pad_to=len(t), noverlap=0, Fs=fs) ax4.psd(y, NFFT=len(t)//2, pad_to=len(t), noverlap=int(0.05*len(t)/2.), Fs=fs) ax4.psd(y, NFFT=len(t)//2, pad_to=len(t), noverlap=int(0.2*len(t)/2.), Fs=fs) -plt.title('Effect of overlap') +ax4.set_ylabel('') +plt.title('overlap') plt.show() Modified: trunk/matplotlib/examples/pylab_examples/psd_demo3.py =================================================================== --- trunk/matplotlib/examples/pylab_examples/psd_demo3.py 2008-12-10 15:22:03 UTC (rev 6549) +++ trunk/matplotlib/examples/pylab_examples/psd_demo3.py 2008-12-10 16:39:01 UTC (rev 6550) @@ -14,11 +14,12 @@ yticks = np.arange(-50, 30, 10) xticks = np.arange(0,550,100) +plt.subplots_adjust(hspace=0.45, wspace=0.3) +plt.subplot(1,2,1) -plt.subplot(1,2,1) plt.psd(xn, NFFT=301, Fs=fs, window=mlab.window_none, pad_to=1024, scale_by_freq=True) -plt.title('Periodogram PSD Estimate') +plt.title('Periodogram') plt.yticks(yticks) plt.xticks(xticks) plt.grid(True) @@ -26,9 +27,10 @@ plt.subplot(1,2,2) plt.psd(xn, NFFT=150, Fs=fs, window=mlab.window_none, noverlap=75, pad_to=512, scale_by_freq=True) -plt.title('Welch Method PSD Estimate') +plt.title('Welch') plt.xticks(xticks) plt.yticks(yticks) +plt.ylabel('') plt.grid(True) plt.show() Modified: trunk/matplotlib/lib/matplotlib/axes.py =================================================================== --- trunk/matplotlib/lib/matplotlib/axes.py 2008-12-10 15:22:03 UTC (rev 6549) +++ trunk/matplotlib/lib/matplotlib/axes.py 2008-12-10 16:39:01 UTC (rev 6550) @@ -2742,6 +2742,8 @@ Keyword arguments: %(Annotation)s + + .. plot:: mpl_examples/pylab_examples/annotation_demo2.py """ a = mtext.Annotation(*args, **kwargs) a.set_transform(mtransforms.IdentityTransform()) @@ -5587,14 +5589,11 @@ *kwargs* keyword args passed on to the :class:`PolyCollection` - .. seealso:: - :file:`examples/pylab_examples/fill_between.py`: - For more examples. - kwargs control the Polygon properties: %(PolyCollection)s + .. plot:: mpl_examples/pylab_examples/fill_between.py """ # Handle united data, such as dates self._process_unit_info(xdata=x, ydata=y1, kwargs=kwargs) Modified: trunk/matplotlib/lib/matplotlib/legend.py =================================================================== --- trunk/matplotlib/lib/matplotlib/legend.py 2008-12-10 15:22:03 UTC (rev 6549) +++ trunk/matplotlib/lib/matplotlib/legend.py 2008-12-10 16:39:01 UTC (rev 6550) @@ -47,7 +47,7 @@ sequence of strings and loc can be a string or an integer specifying the legend location - The location codes are + The location codes are:: 'best' : 0, (only implemented for axis legends) 'upper right' : 1, Modified: trunk/matplotlib/lib/matplotlib/patches.py =================================================================== --- trunk/matplotlib/lib/matplotlib/patches.py 2008-12-10 15:22:03 UTC (rev 6549) +++ trunk/matplotlib/lib/matplotlib/patches.py 2008-12-10 16:39:01 UTC (rev 6550) @@ -1522,6 +1522,7 @@ the fancy box). *mutation_aspect* determines the aspect-ratio of the mutation. + .. plot:: mpl_examples/pylab_examples/fancybox_demo2.py """ _style_list = {} @@ -2574,6 +2575,8 @@ stroked. This is meant to be used to correct the location of the head so that it does not overshoot the destination point, but not all classes support it. + + .. plot:: mpl_examples/pylab_examples/fancyarrow_demo.py """ This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |