From: <jd...@us...> - 2008-11-23 19:06:02
|
Revision: 6433 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=6433&view=rev Author: jdh2358 Date: 2008-11-23 19:05:58 +0000 (Sun, 23 Nov 2008) Log Message: ----------- renamed fill where examples Modified Paths: -------------- trunk/matplotlib/CHANGELOG Added Paths: ----------- trunk/matplotlib/examples/api/fill_where_demo.py Removed Paths: ------------- trunk/matplotlib/examples/api/filled_masked_regions.py Modified: trunk/matplotlib/CHANGELOG =================================================================== --- trunk/matplotlib/CHANGELOG 2008-11-23 19:04:35 UTC (rev 6432) +++ trunk/matplotlib/CHANGELOG 2008-11-23 19:05:58 UTC (rev 6433) @@ -1,10 +1,7 @@ 2008-11-20 Added some static helper methods BrokenHBarCollection.span_masked and - PolyCollection.fill_between_masked for visualizing - non-masked regions. In the longer term, the better - solution will be to fix the relevant classes and functions - to handle masked data, so this may be a temporary solution - - JDH + PolyCollection.fill_between_where for visualizing logical + regions. See examples/api/fill_where_demo.py - JDH 2008-11-12 Add x_isdata and y_isdata attributes to Artist instances, and use them to determine whether either or both Copied: trunk/matplotlib/examples/api/fill_where_demo.py (from rev 6432, trunk/matplotlib/examples/api/filled_masked_regions.py) =================================================================== --- trunk/matplotlib/examples/api/fill_where_demo.py (rev 0) +++ trunk/matplotlib/examples/api/fill_where_demo.py 2008-11-23 19:05:58 UTC (rev 6433) @@ -0,0 +1,50 @@ +""" +Illustrate some helper functions for shading regions where a logical +mask is True +""" +import numpy as np +import matplotlib.pyplot as plt +import matplotlib.collections as collections + + +t = np.arange(0.0, 2, 0.01) +s1 = np.sin(2*np.pi*t) +s2 = 1.2*np.sin(4*np.pi*t) + +fig = plt.figure() +ax = fig.add_subplot(111) +ax.set_title('using fill_between_where') +ax.plot(t, s1, t, s2) +ax.axhline(0, color='black', lw=2) + +collection = collections.PolyCollection.fill_between_where( + t, s1, s2, s1>=s2, color='green', alpha=0.5) +ax.add_collection(collection) + +collection = collections.PolyCollection.fill_between_where( + t, s1, s2, s1<=s2, color='red', alpha=0.5) +ax.add_collection(collection) + + +fig = plt.figure() +ax = fig.add_subplot(111) +ax.set_title('using span_masked') +ax.plot(t, s1, '-') +ax.axhline(0, color='black', lw=2) + +collection = collections.BrokenBarHCollection.span_masked( + t, s1>0, ymin=0, ymax=1, facecolor='green', alpha=0.5) +ax.add_collection(collection) + +collection = collections.BrokenBarHCollection.span_masked( + t, s1<0, ymin=-1, ymax=0, facecolor='red', alpha=0.5) +ax.add_collection(collection) + + + +plt.show() + + + + + Deleted: trunk/matplotlib/examples/api/filled_masked_regions.py =================================================================== --- trunk/matplotlib/examples/api/filled_masked_regions.py 2008-11-23 19:04:35 UTC (rev 6432) +++ trunk/matplotlib/examples/api/filled_masked_regions.py 2008-11-23 19:05:58 UTC (rev 6433) @@ -1,50 +0,0 @@ -""" -Illustrate some helper functions for shading regions where a logical -mask is True -""" -import numpy as np -import matplotlib.pyplot as plt -import matplotlib.collections as collections - - -t = np.arange(0.0, 2, 0.01) -s1 = np.sin(2*np.pi*t) -s2 = 1.2*np.sin(4*np.pi*t) - -fig = plt.figure() -ax = fig.add_subplot(111) -ax.set_title('using fill_between_where') -ax.plot(t, s1, t, s2) -ax.axhline(0, color='black', lw=2) - -collection = collections.PolyCollection.fill_between_where( - t, s1, s2, s1>=s2, color='green', alpha=0.5) -ax.add_collection(collection) - -collection = collections.PolyCollection.fill_between_where( - t, s1, s2, s1<=s2, color='red', alpha=0.5) -ax.add_collection(collection) - - -fig = plt.figure() -ax = fig.add_subplot(111) -ax.set_title('using span_masked') -ax.plot(t, s1, '-') -ax.axhline(0, color='black', lw=2) - -collection = collections.BrokenBarHCollection.span_masked( - t, s1>0, ymin=0, ymax=1, facecolor='green', alpha=0.5) -ax.add_collection(collection) - -collection = collections.BrokenBarHCollection.span_masked( - t, s1<0, ymin=-1, ymax=0, facecolor='red', alpha=0.5) -ax.add_collection(collection) - - - -plt.show() - - - - - This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |