proplot-dev / proplot

🎨 A succinct matplotlib wrapper for making beautiful, publication-quality graphics
https://proplot.readthedocs.io
MIT License
1.07k stars 96 forks source link

Inset_axes zooms doesn't show lines #437

Open singledoggy opened 9 months ago

singledoggy commented 9 months ago

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