Skip to content
This repository has been archived by the owner on Jan 8, 2025. It is now read-only.

Commit

Permalink
Updated deprecated transform functions, added these to tests
Browse files Browse the repository at this point in the history
  • Loading branch information
mhearne-usgs committed Nov 2, 2020
1 parent 1e6937a commit a0598cf
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 11 deletions.
2 changes: 1 addition & 1 deletion impactutils/mapping/mercatormap.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
17 changes: 7 additions & 10 deletions test/mapping/mercatormap_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -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__':
Expand Down

0 comments on commit a0598cf

Please sign in to comment.