joferkington/mplstereonet

ax.grid(kind='polar') not working

MWack opened this issue · 2 comments

MWack commented

Using anaconada with pyton 3 on Linux. Installed mplstereonet 0.5 with pip. Can't get a polar overlay.

import matplotlib.pyplot as plt
import mplstereonet
fig = plt.figure()
ax = fig.add_subplot(111, projection='stereonet')
ax.grid(kind='polar')
fig.show()


AttributeError Traceback (most recent call last)
in ()
4 fig = plt.figure()
5 ax = fig.add_subplot(111, projection='stereonet')
----> 6 ax.grid(kind='polar')
7 fig.show()

/home/wack/bin/anaconda3/lib/python3.4/site-packages/matplotlib/axes/_base.py in grid(self, b, which, axis, **kwargs)
2424
2425 if axis == 'x' or axis == 'both':
-> 2426 self.xaxis.grid(b, which=which, **kwargs)
2427 if axis == 'y' or axis == 'both':
2428 self.yaxis.grid(b, which=which, **kwargs)

/home/wack/bin/anaconda3/lib/python3.4/site-packages/matplotlib/axis.py in grid(self, b, which, **kwargs)
1370 tick.gridOn = self._gridOnMajor
1371 if len(kwargs):
-> 1372 tick.gridline.update(kwargs)
1373 self._major_tick_kw['gridOn'] = self._gridOnMajor
1374 self.stale = True

/home/wack/bin/anaconda3/lib/python3.4/site-packages/matplotlib/artist.py in update(self, props)
854 func = getattr(self, 'set_' + k, None)
855 if func is None or not six.callable(func):
--> 856 raise AttributeError('Unknown property %s' % k)
857 func(v)
858 changed = True

AttributeError: Unknown property kind

Polar grids are only supported in the development version, at the moment. I haven't put out a release of mplstereonet since last summer, so v0.5 is a bit behind.

I should probably try to get a release out fairly soon. I haven't had much time to maintain these projects lately, though. My apologies for that. In the meantime, you can install the current development version with pip install https://github.com/joferkington/mplstereonet/zipball/master.

For anyone else with this issue you can plot the polar plot using matplotlib inputs:

ax.grid(kind = 'polar', alpha = 0.5) 
ax.set_longitude_grid_ends(80)
plt.xticks(np.arange(-2*np.pi,2*np.pi,np.pi/18))
plt.yticks(np.arange(0,100*np.pi/180,10*np.pi/180))    
ax._polar.set_position(ax.get_position())