proplot icon indicating copy to clipboard operation
proplot copied to clipboard

Inset_axes zooms doesn't show lines

Open singledoggy opened this issue 2 years ago • 0 comments

Description

inset_axes doesn't show lines. This may related to #133.

Steps to reproduce

import cartopy.crs as ccrs
import matplotlib as mpl
import proplot as pplt
from mpl_toolkits.axes_grid1.inset_locator import mark_inset

pplt.rc.reso = "med"

extents_main = [70, 140, 10, 60]
lon_min, lon_max, lat_min, lat_max = extents_main
crs = ccrs.PlateCarree()
fig, axs = pplt.subplots(
    nrows=1, ncols=1, share=False, projection=crs,
)

ax = axs[0]
axs.format(
    lonlim=(lon_min, lon_max),
    latlim=(lat_min, lat_max),
    lonlabels="b",
    latlabels="l",
   # abc=True,
)

for ax in axs:

    ax_sub = ax.inset_axes(
        (130, 10, 10, 10),
        transform=axs.transData,
        projection=crs,
        zoom='True',
        zoom_kw={'ec': 'red', 'lw': 2}
    )

#    if use mark_inset, we can see the lines
#    mark_inset(ax, ax_sub, loc1=1, loc2=3, ec="red",ls= "--", lw=1.5)

    ax_sub.format(
        grid=False,
        lonlim=(110, 120),
        latlim=(35, 45),
        color="red",
        linewidth=1.5,
        ticklabelweight="bold",
    )


Expected behavior:

image

Actual behavior:

image

Quick fix

#    if use mark_inset, we can see the lines
mark_inset(ax, ax_sub, loc1=1, loc2=3, ec="red",ls= "--", lw=1.5)

Maybe the default zoom can be get by mark_inset?

Proplot version

Paste the results of import matplotlib; print(matplotlib.version); import proplot; print(proplot.version) here. 3.4.3 0.9.5.post360

singledoggy avatar Sep 17 '23 12:09 singledoggy