Description
Bug report
Bug summary
matplotlib.testing.compare.compare_images
complains about image sizes do not match.
Code for reproduction
astropy 4.0.dev24570
matplotlib 3.0.2+2458.g959e9f3a9
import os
from matplotlib import pyplot as plt
from astropy.io import fits
from astropy.wcs import WCS
# https://github.com/astropy/astropy/blob/master/astropy/visualization/wcsaxes/tests/data/msx_header
data_dir = '/my/path/astropy/visualization/wcsaxes/tests/data'
msx_header = fits.Header.fromtextfile(os.path.join(data_dir, 'msx_header'))
wcs = WCS(msx_header)
fig = plt.figure(figsize=(3, 3))
ax = fig.add_axes([0.25, 0.25, 0.5, 0.5], projection=wcs, aspect='auto')
ax.coords[0].set_axislabel("Label 1")
ax.coords[1].set_axislabel("Label 2")
ax.coords[1].set_axislabel_visibility_rule('always')
ax.coords[1].ticklabels.set_visible(False)
plt.draw()
fig.savefig('ztemp.png')
This is supposed to produce something that looks like test_axislabels_regression.png.
Actual outcome
Downloading the "truth" file above and then doing this comparison locally on my machine, I get this:
>>> from matplotlib.testing.compare import compare_images
>>> compare_images('test_axislabels_regression.png', 'ztemp.png', tol=2)
...
ImageComparisonFailure: Image sizes do not match expected size:
(214, 208, 3) actual size (300, 300, 3)
On CircleCI, we get something like https://circleci.com/gh/astropy/astropy/30970
ImageComparisonFailure: Image sizes do not match expected size:
(214, 208, 3) actual size (170, 170, 3)
xref astropy/astropy#8678
Expected outcome
I am not sure what the expected outcome should be. Is there a way to ignore image size? It seems that image size depends on the machine you are running on.
Matplotlib version
- Operating system: RHEL7 (locally) and Debian (CircleCI)
- Matplotlib version: 3.0.2+2458.g959e9f3a9 (locally) and 3.0.2+2456.g28e32c6 (CircleCI)
- Matplotlib backend (
print(matplotlib.get_backend())
): Qt5Agg (locally) - Python version: 3.7.1 (locally) and 3.6.7 (CircleCI)
- Jupyter version (if applicable): N/A
- Other libraries: astropy, numpy
I installed the dev version locally using pip install git+https://https://github.com/matplotlib/matplotlib
command.