-
Notifications
You must be signed in to change notification settings - Fork 387
Closed
Description
The following code works with other projections, but not orthographic. Any thoughts?
import cartopy.crs as ccrs
import numpy as np
import matplotlib.pyplot as plt
%matplotlib inline
latitude = np.arange(90, -90.75, -0.75)
longitude = np.arange(0, 360, 0.75)
data = np.arange(241 * 480).reshape(241, 480)
# ax = plt.axes(projection=ccrs.Mollweide())
ax = plt.axes(projection=ccrs.Orthographic())
ax.contourf(longitude, latitude, data, transform=ccrs.PlateCarree())
ax.coastlines()
---------------------------------------------------------------------------
ValueError Traceback (most recent call last)
/Users/shoyer/miniconda/envs/santa-maria/lib/python2.7/site-packages/IPython/core/formatters.pyc in __call__(self, obj)
328 pass
329 else:
--> 330 return printer(obj)
331 # Finally look for special method names
332 method = _safe_get_formatter_method(obj, self.print_method)
/Users/shoyer/miniconda/envs/santa-maria/lib/python2.7/site-packages/IPython/core/pylabtools.pyc in <lambda>(fig)
205
206 if 'png' in formats:
--> 207 png_formatter.for_type(Figure, lambda fig: print_figure(fig, 'png', **kwargs))
208 if 'retina' in formats or 'png2x' in formats:
209 png_formatter.for_type(Figure, lambda fig: retina_figure(fig, **kwargs))
/Users/shoyer/miniconda/envs/santa-maria/lib/python2.7/site-packages/IPython/core/pylabtools.pyc in print_figure(fig, fmt, bbox_inches, **kwargs)
115
116 bytes_io = BytesIO()
--> 117 fig.canvas.print_figure(bytes_io, **kw)
118 data = bytes_io.getvalue()
119 if fmt == 'svg':
/Users/shoyer/miniconda/envs/santa-maria/lib/python2.7/site-packages/matplotlib/backend_bases.pyc in print_figure(self, filename, dpi, facecolor, edgecolor, orientation, format, **kwargs)
2156 orientation=orientation,
2157 dryrun=True,
-> 2158 **kwargs)
2159 renderer = self.figure._cachedRenderer
2160 bbox_inches = self.figure.get_tightbbox(renderer)
/Users/shoyer/miniconda/envs/santa-maria/lib/python2.7/site-packages/matplotlib/backends/backend_agg.pyc in print_png(self, filename_or_obj, *args, **kwargs)
519
520 def print_png(self, filename_or_obj, *args, **kwargs):
--> 521 FigureCanvasAgg.draw(self)
522 renderer = self.get_renderer()
523 original_dpi = renderer.dpi
/Users/shoyer/miniconda/envs/santa-maria/lib/python2.7/site-packages/matplotlib/backends/backend_agg.pyc in draw(self)
467
468 try:
--> 469 self.figure.draw(self.renderer)
470 finally:
471 RendererAgg.lock.release()
/Users/shoyer/miniconda/envs/santa-maria/lib/python2.7/site-packages/matplotlib/artist.pyc in draw_wrapper(artist, renderer, *args, **kwargs)
57 def draw_wrapper(artist, renderer, *args, **kwargs):
58 before(artist, renderer)
---> 59 draw(artist, renderer, *args, **kwargs)
60 after(artist, renderer)
61
/Users/shoyer/miniconda/envs/santa-maria/lib/python2.7/site-packages/matplotlib/figure.pyc in draw(self, renderer)
1083 dsu.sort(key=itemgetter(0))
1084 for zorder, a, func, args in dsu:
-> 1085 func(*args)
1086
1087 renderer.close_group('figure')
/Users/shoyer/miniconda/envs/santa-maria/lib/python2.7/site-packages/matplotlib/artist.pyc in draw_wrapper(artist, renderer, *args, **kwargs)
57 def draw_wrapper(artist, renderer, *args, **kwargs):
58 before(artist, renderer)
---> 59 draw(artist, renderer, *args, **kwargs)
60 after(artist, renderer)
61
/Users/shoyer/miniconda/envs/santa-maria/lib/python2.7/site-packages/cartopy/mpl/geoaxes.pyc in draw(self, renderer, inframe)
336 if self.outline_patch.reclip or self.background_patch.reclip:
337 clipped_path = clip_path(self.outline_patch.orig_path,
--> 338 self.viewLim)
339 self.outline_patch._path = clipped_path
340 self.background_patch._path = clipped_path
/Users/shoyer/miniconda/envs/santa-maria/lib/python2.7/site-packages/cartopy/mpl/clip_path.pyc in clip_path(subject, clip_bbox)
115
116 """
--> 117 return subject.clip_to_bbox(clip_bbox)
118 else:
119 def clip_path(subject, clip_bbox):
/Users/shoyer/miniconda/envs/santa-maria/lib/python2.7/site-packages/matplotlib/path.pyc in clip_to_bbox(self, bbox, inside)
932 verts = _path.clip_path_to_rect(self, bbox, inside)
933 paths = [Path(poly) for poly in verts]
--> 934 return self.make_compound_path(*paths)
935
936
/Users/shoyer/miniconda/envs/santa-maria/lib/python2.7/site-packages/matplotlib/path.pyc in make_compound_path(cls, *args)
330 total_length = sum(lengths)
331
--> 332 vertices = np.vstack([x.vertices for x in args])
333 vertices.reshape((total_length, 2))
334
/Users/shoyer/miniconda/envs/santa-maria/lib/python2.7/site-packages/numpy/core/shape_base.pyc in vstack(tup)
226
227 """
--> 228 return _nx.concatenate([atleast_2d(_m) for _m in tup], 0)
229
230 def hstack(tup):
ValueError: need at least one array to concatenate