diff --git a/impactutils/mapping/mercatormap.py b/impactutils/mapping/mercatormap.py index d3b6c5d..4ee38a7 100644 --- a/impactutils/mapping/mercatormap.py +++ b/impactutils/mapping/mercatormap.py @@ -353,7 +353,7 @@ def getCityEdges(self, row, fontname, fontsize, shadow, zorder): """ th = self.renderRow(row, fontname, fontsize, shadow, zorder, test=True) bbox = th.get_window_extent(self._figure.canvas.get_renderer()) - axbox = bbox.inverse_transformed(self._ax_clone.transData) + axbox = bbox.transformed(self._ax_clone.transData.inverted()) left, bottom, right, top = axbox.extents xpad = (right - left) * self._padding ypad = (top - bottom) * self._padding diff --git a/test/mapping/mercatormap_test.py b/test/mapping/mercatormap_test.py index f91903c..ed1a6ce 100755 --- a/test/mapping/mercatormap_test.py +++ b/test/mapping/mercatormap_test.py @@ -27,21 +27,18 @@ def test_mmap(outfile=None, bounds=None): figsize = (7, 7) cities = Cities.fromDefault() mmap = MercatorMap(bounds, figsize, cities, padding=0.5) - fig = mmap.figure ax = mmap.axes # TODO -- Travis hangs here so commenting out stuff so it doesn't hang. # Should sort out issue to fully test this module. -# fig.canvas.draw() - -# ax.coastlines(resolution="10m", zorder=10) -# plt.show() -# mmap.drawCities(shadow=True) -# if outfile: -# plt.savefig(outfile) -# print(f"Figure saved to {outfile}") -# return + # fig.canvas.draw() + ax.coastlines(resolution="10m", zorder=10) + # plt.show() + mmap.drawCities(shadow=True) + if outfile: + plt.savefig(outfile) + print(f"Figure saved to {outfile}") if __name__ == '__main__':