Skip to content

Commit

Permalink
Updated use of inset map, because InsetPosition is deprecated
Browse files Browse the repository at this point in the history
  • Loading branch information
blaylockbk committed Dec 17, 2024
1 parent 3135853 commit f356123
Showing 1 changed file with 5 additions and 7 deletions.
12 changes: 5 additions & 7 deletions herbie/toolbox/cartopy_tools.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,6 @@
import xarray as xr
from cartopy.io import shapereader
from metpy.plots import USCOUNTIES
from mpl_toolkits.axes_grid1.inset_locator import InsetPosition

from typing import Literal, Optional, Union
from herbie import Path
Expand Down Expand Up @@ -433,13 +432,12 @@ def inset_global_map(

# Create and position inset
ortho = ccrs.Orthographic(central_latitude=center_lat, central_longitude=center_lon)
ax_inset = plt.axes([0, 0, 1, 1], projection=ortho)
ax_inset.set_global()

ip = InsetPosition(
ax, [inset_x - inset_size / 2, inset_y - inset_size / 2, inset_size, inset_size]
ax_inset = ax.inset_axes(
[inset_x - inset_size / 2, inset_y - inset_size / 2, inset_size, inset_size],
projection=ortho,
)
ax_inset.set_axes_locator(ip)
ax_inset.set_global()
ax_inset.set_zorder(1000000) # make sure the inset is on top of everything

# ===================
# Inset Map Cosmetics
Expand Down

0 comments on commit f356123

Please sign in to comment.