def test_inset_aliases(): """ Test the aliases for the inset function. """ fig = Figure() fig.basemap(region="MG+r2", frame="afg") with fig.inset(position="jTL+w3.5c+o0.2c", margin=0, box="+pgreen"): fig.basemap(region="g", projection="G47/-20/4c", frame="afg") return fig
def test_inset_context_manager(): """ Test that the inset context manager works and, once closed, plotting elements are added to the larger figure. """ fig = Figure() fig.basemap(region=[-74, -69.5, 41, 43], projection="M9c", frame=True) with fig.inset(position="jBL+w3c+o0.2c", margin=0, box="+pblack"): fig.basemap(region=[-80, -65, 35, 50], projection="M3c", frame="afg") fig.basemap( rose="jTR+w3c") # Pass rose argument with basemap after the inset return fig
C=True, verbose=True, L="1p/black") if mt_colorbar: fig.colorbar(position="n.95/.825+w-2c/.45c", frame='af+l"depth [km]"') # Scalebar, need to use config to set the pen thickness of the scale with config(MAP_TICK_PEN_PRIMARY=1.5): fig.basemap(region=region, projection=projection, #frame=["WSne", "gfa"], map_scale=map_scale) # Landmark text fig.text(textfiles=landmarks_fid) # Plot the whole of Alaska as an inset to give context if inset: with fig.inset(position="n0/.75+w5c/4c", margin=0): # Plot the whole of Alaska as the inset fig.coast(region=[-170, -135, 53, 72], projection="L-150/62/63/64/3.5c", land="gray", water="white", shorelines="0p,black", frame=False, resolution="h", area_thresh=100) # !!! THIS DOESNT WORK Put a box in the inset around Northern Alaska rectangle = [region[0], region[2], region[1], region[3]] fig.plot(data=rectangle, style="r+s", pen="1p,red") # Plot the plate coupling / slip rate deficit with a no-label colorbar # Save and show fig.savefig(output, transparent=bg_transparent) fig.show(method="external")