From: Michael H. <mh...@us...> - 2008-06-11 15:05:49
|
I'm reposting this, as it may have gotten lost in other discussions. I think there is possibly a bug in the PNG renderer for TkAgg (which is what I think I'm using when I say "matplotlib.use('agg')"), as I get different visual results from savefig when saving to EPS and PNG. If this isn't a bug, can someone please let me know what I'm doing wrong, or point me to a workaround for saving to PNG files? Thanks, Mike -------- Original Message -------- Subject: [Matplotlib-users] bounding box functionality with text() function Date: Mon, 09 Jun 2008 14:35:24 -0600 From: Michael Hearne <mh...@us...> Reply-To: mh...@us... To: MatPlotLib Users <mat...@li...> I'm having a problem with the bbox keyword to the text() function. The code below, for me, results in one postscript file that looks fine, but the PNG file has letters outside of the bounding box for most of the words I plot. I'm using matplotlib '0.98pre' on Mac OS X. import matplotlib matplotlib.use('agg') from pylab import * x = array([6,7,8,9,10]) y = array([6,7,8,9,10]) fig = figure() plot(x,y,'rx') hold('on') fontdict2 = {'fontweight':'light', 'color': 'k', 'fontsize':9} words = ['Hi','Goodbye','What''s this','Aloha','So long, farewell'] for i in range(0,len(x)): tx = x[i] ty = y[i] word = words[i] text(tx,ty,word,fontdict2,bbox={'facecolor':'w'}) savefig('textplot.eps') savefig('textplot.png') close(fig) -- ------------------------------------------------------ Michael Hearne mh...@us... (303) 273-8620 USGS National Earthquake Information Center 1711 Illinois St. Golden CO 80401 Senior Software Engineer Synergetics, Inc. ------------------------------------------------------ ------------------------------------------------------------------------- Check out the new SourceForge.net Marketplace. It's the best place to buy or sell services for just about anything Open Source. http://sourceforge.net/services/buy/index.php _______________________________________________ Matplotlib-users mailing list Mat...@li... https://lists.sourceforge.net/lists/listinfo/matplotlib-users -- ------------------------------------------------------ Michael Hearne mh...@us... (303) 273-8620 USGS National Earthquake Information Center 1711 Illinois St. Golden CO 80401 Senior Software Engineer Synergetics, Inc. ------------------------------------------------------ |