user1956609
user1956609

Reputation: 2202

Cartopy map visualization error: unknown projection

I want to try some of the Cartopy gallery examples. I'm trying the African map now, but when I run:

import cartopy
import matplotlib.pyplot as plt

ax = plt.axes(projection=cartopy.crs.PlateCarree())

I get the following error:

Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/usr/lib/pymodules/python2.7/matplotlib/pyplot.py", line 641, in axes
    if len(args)==0: return subplot(111, **kwargs)
  File "/usr/lib/pymodules/python2.7/matplotlib/pyplot.py", line 766, in subplot
    a = fig.add_subplot(*args, **kwargs)
  File "/usr/lib/pymodules/python2.7/matplotlib/figure.py", line 772, in add_subplot
    projection_class = get_projection_class(projection)
  File "/usr/lib/pymodules/python2.7/matplotlib/projections/__init__.py", line 61, in get_projection_class
    raise ValueError("Unknown projection '%s'" % projection)
ValueError: Unknown projection '<cartopy.crs.PlateCarree object at 0x41af230>'

I haven't been able to get any of these projections working ... I think I have all the dependencies and can't figure out what is causing this error. Any ideas?

Upvotes: 1

Views: 307

Answers (1)

pelson
pelson

Reputation: 21829

Looks like you may have a very old version of Matplotlib. Any chance you have v1.1 or less?

I strongly recommend updating to the latest release of matplotlib, namely v1.4.0 (on 2nd Oct 2014), which gives all kinds of improvements over the v1.1 release from 2011.

HTH,

Upvotes: 1

Related Questions