Skip to content

Support geographic projection #395

@zxdawn

Description

@zxdawn

Describe the issue

This tool works well for normal figures, but not for cartopy plots.

Code

matplotlib

import matplotlib.pyplot as plt
import cartopy.crs as ccrs

fig, axes = plt.subplots(2, 2, sharex=True, sharey=True)
for i in range(len(axs)):
    for j in range(len(axs[i])):
        axes[i, j].scatter(0, 0)

matplotlib_crop

Cartopy

import matplotlib.pyplot as plt
import cartopy.crs as ccrs

proj = ccrs.NorthPolarStereo()
fig, axes = plt.subplots(2, 2, subplot_kw=dict(projection=proj), sharex=True, sharey=True)
for i in range(len(axs)):
    for j in range(len(axs[i])):
        axes[i, j].coastlines()

cattopy_crop

Versions

 3.8.12 | packaged by conda-forge | (default, Oct 12 2021, 21:59:51) 
[GCC 9.4.0]
ipympl version: 0.8.2
Selected Jupyter core packages...
IPython          : 7.29.0
ipykernel        : 6.4.2
ipywidgets       : 7.6.5
jupyter_client   : 6.1.12
jupyter_core     : 4.9.1
jupyter_server   : 1.11.2
jupyterlab       : 3.2.1
nbclient         : 0.5.4
nbconvert        : 6.2.0
nbformat         : 5.1.3
notebook         : 6.4.5
qtconsole        : 5.1.1
traitlets        : 5.1.1
Known nbextensions:
  config dir: /usr/people/zhang/miniconda3/envs/knmi_arctic/etc/jupyter/nbconfig
    notebook section
      bqplot/extension  enabled 
      - Validating: OK
      ipyevents/extension  enabled 
      - Validating: OK
      ipyspin/extension  enabled 
      - Validating: OK
      ipytree/extension  enabled 
      - Validating: OK
      ipyurl/extension  enabled 
      - Validating: OK
      jupyter-leaflet/extension  enabled 
      - Validating: OK
      jupyter-matplotlib/extension  enabled 
      - Validating: OK
      jupyterlab-plotly/extension  enabled 
      - Validating: OK
      @here/map-widget-for-jupyter/extension  enabled 
      - Validating: OK
      voila/extension  enabled 
      - Validating: OK
      jupyter-js-widgets/extension  enabled 
      - Validating: OK
JupyterLab v3.2.1
/usr/people/zhang/miniconda3/envs/knmi_arctic/share/jupyter/labextensions
        jupyter-matplotlib v0.10.2 enabled OK
        ipyspin v0.1.5 enabled OK
        bqplot v0.5.32 enabled OK (python, bqplot)
        ipyurl v0.1.2 enabled OK (python, ipyurl)
        jupyter-leaflet v0.14.0 enabled OK
        ipytree v0.2.1 enabled OK
        ipyevents v2.0.1 enabled OK
        jupyterlab-plotly v5.3.1 enabled OK
        @here/map-widget-for-jupyter v1.1.3 enabled OK
        @jupyter-widgets/jupyterlab-manager v3.0.1 enabled OK (python, jupyterlab_widgets)
        @voila-dashboards/jupyterlab-preview v2.0.7 enabled OK (python, voila)
        @pyviz/jupyterlab_pyviz v2.1.0 enabled OK (python, pyviz_comms)

Other labextensions (built into JupyterLab)
   app dir: /usr/people/zhang/miniconda3/envs/knmi_arctic/share/jupyter/lab

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions