From: John H. <jd...@gm...> - 2008-05-09 19:36:39
|
On Fri, May 9, 2008 at 2:31 PM, Bryan Fodness <bry...@gm...> wrote: > i have been using the fill function to highlight a region on my plot, but > now i do not want it to be filled. i have tried using alpha=0.1, but that > also makes my edgecolor transparent. is there a "box" function that does > not fill a region yet still has the outline of the "box". i tried using > patch.rectangle, but it was not what i needed. Use a matplotlib.patches.Rectangle, and set the facecolor='None': import matplotlib.pyplot as plt import matplotlib.patches as patches fig = plt.figure() ax = fig.add_subplot(111) ax.plot([1,2,3], [1,2,3]) # use zorder to make sure it is over the line rect = patches.Rectangle((1.5, 1.5), 1.0, 1.0, facecolor='None', zorder=10) ax.add_patch(rect) plt.show() Hope this helps, JDH |