Closed
Description
The default MacOSX backend does not display the expected output for the following code. Both the QT4Agg and TkAgg backends display correctly.
Code illustrating the problem:
# from matplotlib import use
# use("QT4Agg")
# use("TkAgg")
import matplotlib.pyplot as plt
import matplotlib.transforms as mtrans
import numpy as np
plt.figure()
ax = plt.subplot(111)
base_trans = ax.transData
mtx = np.array([[1,1,0],
[0,1,0],
[0,0,1]])
tr = mtrans.Affine2D(matrix=mtx) + base_trans
plt.plot([1,2,3], [1,2,3], 'gray', transform=tr)
plt.scatter([1,2,3], [1,2,3], c='k', marker='D', transform=tr)
plt.show()Environment:
>>> import matplotlib
>>> matplotlib.__version__
'1.2.0'
>>> matplotlib.__file__
'/opt47/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/matplotlib/__init__.pyc'
>>> matplotlib.get_configdir()
'/Users/jdgleeson/.matplotlib'
>>> matplotlib.get_backend()
'MacOSX'
TkAgg.png showing expected results (via X11 on my Mac).
MacOSX.png shows incorrect results.
Metadata
Metadata
Assignees
Labels
No labels


Activity
goldnd commentedon Apr 6, 2013
The same thing happens with quiver plots.
pelson commentedon Apr 7, 2013
Thanks for reporting @jdgleeson (and the comment @goldnd).
mdboom commentedon Apr 8, 2013
@mdehoon: Any thoughts?
mdehoon commentedon Apr 9, 2013
It looks like b and c in the function _transformation_converter in src/_macosx.m should be switched.
@jdgleeson @goldnd , could you try this and do some tests?
jdgleeson commentedon Apr 9, 2013
On 2013-04-09, at 2:03 AM, mdehoon wrote:
--- src/_macosx.m.orig 2012-11-08 09:38:38.000000000 -0700
+++ src/_macosx.m 2013-04-09 09:17:37.000000000 -0600
@@ -1205,8 +1205,8 @@
return 0;
}
const double a = (double)PyArray_GETPTR2(object, 0, 0);
const double d = (double)PyArray_GETPTR2(object, 1, 1);
const double tx = (double)PyArray_GETPTR2(object, 0, 2);
const double ty = (double)PyArray_GETPTR2(object, 1, 2);
mdehoon commentedon Apr 10, 2013
@jdgleeson Thanks for trying this fix. Could you also try the other matplotlib examples to make sure this doesn't introduce some new bug?
jdgleeson commentedon Apr 10, 2013
On 2013-04-09, at 6:41 PM, mdehoon wrote:
Ran 1214 tests in 973.796s
FAILED (KNOWNFAIL=300, SKIP=3, failures=2)
Sorry for the delay; I was trying to install Inkscape and ran into a
problem building a dependency.
The two failures are in
FAIL: matplotlib.tests.test_text.test_font_styles.test
ImageComparisonFailure: images not close: /Users/jdgleeson/
result_images/test_text/font_styles.png vs. /Users/jdgleeson/
result_images/test_text/font_styles-expected.png (RMS 47.353)
ImageComparisonFailure: images not close: /Users/jdgleeson/
result_images/test_text/font_styles_pdf.png vs. /Users/jdgleeson/
result_images/test_text/font_styles-expected_pdf.png (RMS 23.423)
In both cases, all fonts look the same as "Normal Font"
I found this issue which may explain it.
macosx backend doesn't find fonts the same way as other backends
#781
mdehoon commentedon Apr 11, 2013
@jdgleeson Thanks! Then at least we know that this fix doesn't introduce new problems, as
the two test failures are not related to the current issue.
Switching b and c in _transformation_converter to fix issue matplotli…
Merge pull request #1903 from mdehoon/fix_for_issue_1886