[matplotlib-devel] problem with scatter legend entries with dpi != 72
Hello, I am encountering a problem with the legend entries for scatter plots when setting a figure DPI different from the default of 72. When the DPI is higher than 72, the markers in the legend become disproportionately large and get scrunched together. It looks like what is happening is the marker size is being transformed twice, and the offsets are not being transformed at all. I have tried to debug it, and it looks like the problem is the way that the DrawingArea that contains the legend interacts with the Collection object. To fix the spacing, the _transOffset property of the Collection needs to be set, but the transform being applied by the DrawingArea ends up scaling the marker size instead. I have attached a sample script which shows the problem. I am using the current development version of matplotlib checked out from git, with Python 2.6.2. The issue also exists in version 0.99.1. Thanks, Ray Speth #!/usr/bin/python import matplotlib.pyplot as plt import numpy as np f = plt.figure() f.set_dpi(200) x = np.arange(10) h = plt.scatter(x,-x) g = plt.plot(x,x,'ro-') L = plt.legend([h,g],['scatter','plot']) #f.savefig('scatterdbg.png',dpi=200) plt.show() -- Download Intel® Parallel Studio Eval Try the new software tools for yourself. Speed compiling, find bugs proactively, and fine-tune applications for parallel performance. See why Intel Parallel Studio got high marks during beta. http://p.sf.net/sfu/intel-sw-dev___ Matplotlib-devel mailing list Matplotlib-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-devel
Re: [matplotlib-devel] problem with scatter legend entries with dpi != 72
Thanks for the report. A fix has been committed in r8191 (maint. branch) and r8292 (head). Give it a try and let me know of any problems. Regards, -JJ On Sat, Mar 13, 2010 at 4:49 PM, Ray Speth wrote: > Hello, > > I am encountering a problem with the legend entries for scatter plots when > setting a figure DPI different from the default of 72. When the DPI is > higher than 72, the markers in the legend become disproportionately large > and get scrunched together. It looks like what is happening is the marker > size is being transformed twice, and the offsets are not being transformed > at all. > > I have tried to debug it, and it looks like the problem is the way that the > DrawingArea that contains the legend interacts with the Collection object. > To fix the spacing, the _transOffset property of the Collection needs to be > set, but the transform being applied by the DrawingArea ends up scaling the > marker size instead. > > I have attached a sample script which shows the problem. I am using the > current development version of matplotlib checked out from git, with Python > 2.6.2. The issue also exists in version 0.99.1. > > Thanks, > Ray Speth > > -- > Download Intel® Parallel Studio Eval > Try the new software tools for yourself. Speed compiling, find bugs > proactively, and fine-tune applications for parallel performance. > See why Intel Parallel Studio got high marks during beta. > http://p.sf.net/sfu/intel-sw-dev > ___ > Matplotlib-devel mailing list > Matplotlib-devel@lists.sourceforge.net > https://lists.sourceforge.net/lists/listinfo/matplotlib-devel > > -- Download Intel® Parallel Studio Eval Try the new software tools for yourself. Speed compiling, find bugs proactively, and fine-tune applications for parallel performance. See why Intel Parallel Studio got high marks during beta. http://p.sf.net/sfu/intel-sw-dev ___ Matplotlib-devel mailing list Matplotlib-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-devel