``````

In [9]:

%matplotlib inline

``````
``````

``````
``````

In [10]:

import matplotlib.pyplot as plt
from attitude.orientation.pca import random_pca
from attitude.plot import cartopy_girdle, cartopy_normal
from cartopy import crs
import cartopy

``````
``````

In [18]:

fit = random_pca()

``````

Cartopy is meant for drawing maps (and is extremely powerful in this regard) but we can use it to plot orientation measurements as well.

``````

In [19]:

ax = plt.axes(projection=crs.Orthographic(0,0))
ax.set_global()

``````
``````

*{stroke-linecap:butt;stroke-linejoin:round;}

``````

We can use CartoPy's feature interface to plot uncertain orientations.

``````

In [20]:

#ax = plt.axes(projection=crs.Orthographic(0,0))
list(cartopy.feature.OCEAN.geometries())

``````
``````

Out[20]:

[<shapely.geometry.multipolygon.MultiPolygon at 0x114ea5400>,
<shapely.geometry.multipolygon.MultiPolygon at 0x114ea5e48>]

``````
``````

In [21]:

ax = plt.axes(projection=crs.Orthographic(0,0))
ax.gridlines(linestyle=':')

obj = cartopy_girdle(fit)
ax.set_global()

``````
``````

*{stroke-linecap:butt;stroke-linejoin:round;}

``````
``````

In [27]:

p = crs.Mollweide()
p._threshold = 1000
ax = plt.axes(projection=p)

obj = cartopy_girdle(fit)

``````
``````

Out[27]:

<cartopy.mpl.feature_artist.FeatureArtist at 0x114e77160>

*{stroke-linecap:butt;stroke-linejoin:round;}

``````
``````

In [30]:

p = crs.NorthPolarStereo()
ax = plt.axes(projection=p)
ax.set_extent((-180,180,75,90), crs.PlateCarree())

ax.gridlines(linestyle=':')

``````
``````

Out[30]:

<cartopy.mpl.gridliner.Gridliner at 0x11566b358>

Self-intersection at or near point -90 90
Self-intersection at or near point -90 90

*{stroke-linecap:butt;stroke-linejoin:round;}

``````
``````

In [ ]:

``````