Cartopy: Support for `plt.subplots`

Created on 24 Jun 2017  路  2Comments  路  Source: SciTools/cartopy

I can't figure out how to get transform to work with plt.subplots. Since most people are using this function to create their axes these days, I think it'd be useful to patch this function in the same way that plt.subplot is patched...

Most helpful comment

Cartopy doesn't patch plt.subplot, for that one matplotlib allows the projection keyword argument, which is what Cartopy uses.

To use plt.subplots do:

import matplotlib.pyplot as plt
import cartopy.crs as ccrs
proj = ccrs.Geostationary()
fig, axes = plt.subplots(2, 2, subplot_kw=dict(projection=proj)))

I'm not saying it's pretty, but it's really a matplotlib problem, not really a CartoPy problem unless cartopy really wants to get in the business of overwriting matplotlib API.

All 2 comments

Cartopy doesn't patch plt.subplot, for that one matplotlib allows the projection keyword argument, which is what Cartopy uses.

To use plt.subplots do:

import matplotlib.pyplot as plt
import cartopy.crs as ccrs
proj = ccrs.Geostationary()
fig, axes = plt.subplots(2, 2, subplot_kw=dict(projection=proj)))

I'm not saying it's pretty, but it's really a matplotlib problem, not really a CartoPy problem unless cartopy really wants to get in the business of overwriting matplotlib API.

oh hoh - that's nifty, good to know. I'm gonna close this issue and suggest to add an example that shows this off in my other issue ;-) #899

Was this page helpful?
0 / 5 - 0 ratings

Related issues

veenstrajelmer picture veenstrajelmer  路  6Comments

mjarrett picture mjarrett  路  5Comments

rutgerhofste picture rutgerhofste  路  3Comments

chengzhuzhang picture chengzhuzhang  路  8Comments

deeplycloudy picture deeplycloudy  路  8Comments