本文整理汇总了Python中matplotlib.patches.Polygon.get_edgecolor方法的典型用法代码示例。如果您正苦于以下问题:Python Polygon.get_edgecolor方法的具体用法?Python Polygon.get_edgecolor怎么用?Python Polygon.get_edgecolor使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类matplotlib.patches.Polygon
的用法示例。
在下文中一共展示了Polygon.get_edgecolor方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: Map
# 需要导入模块: from matplotlib.patches import Polygon [as 别名]
# 或者: from matplotlib.patches.Polygon import get_edgecolor [as 别名]
#.........这里部分代码省略.........
Args:
sep: distance between graticules in deg
parallel_fmt: formatter for parallel labels
meridian_fmt: formatter for meridian labels
dec_min: minimum declination for graticules
dec_max: maximum declination for graticules
ra_min: minimum declination for graticules (for which reference RA=0)
ra_max: maximum declination for graticules (for which reference RA=0)
**kwargs: styling of `matplotlib.lines.Line2D` for the graticules
"""
self._config['grid'] = _parseArgs(locals())
self._dec_range = np.linspace(dec_min, dec_max, self._resolution)
self._ra_range = np.linspace(ra_min, ra_max, self._resolution) + self.proj.ra_0
_parallels = np.arange(-90+sep,90,sep)
if self.proj.ra_0 % sep == 0:
_meridians = np.arange(sep * ((self.proj.ra_0 + 180) // sep), sep * ((self.proj.ra_0 - 180) // sep - 1), -sep)
else:
_meridians = np.arange(sep * ((self.proj.ra_0 + 180) // sep), sep * ((self.proj.ra_0 - 180) // sep), -sep)
# clean up previous grid
artists = self.artists('grid-meridian') + self.artists('grid-parallel')
for artist in artists:
artist.remove()
# clean up frame meridian and parallel labels because they're tied to the grid
artists = self.artists('meridian-label') + self.artists('parallel-label')
for artist in artists:
artist.remove()
# styling: based on edge
ls = kwargs.pop('ls', '-')
lw = kwargs.pop('lw', self._edge.get_linewidth() / 2)
c = kwargs.pop('c', self._edge.get_edgecolor())
alpha = kwargs.pop('alpha', 0.2)
zorder = kwargs.pop('zorder', self._edge.get_zorder() - 1)
for p in _parallels:
self._setParallel(p, gid='grid-parallel-%r' % p, lw=lw, c=c, alpha=alpha, zorder=zorder, **kwargs)
for m in _meridians:
self._setMeridian(m, gid='grid-meridian-%r' % m, lw=lw, c=c, alpha=alpha, zorder=zorder, **kwargs)
# (re)generate the frame labels
for method in ['labelMeridiansAtFrame', 'labelParallelsAtFrame']:
if method in self._config.keys():
getattr(self, method)(**self._config[method])
else:
getattr(self, method)()
# (re)generate edge labels
for method in ['labelMeridianAtParallel', 'labelParallelAtMeridian']:
if method in self._config.keys():
args_list = self._config.pop(method, [])
for args in args_list.values():
getattr(self, method)(**args)
else:
# label meridians: at the poles if they are not points
if method == 'labelMeridianAtParallel':
# determine the parallel that has the most space for labels
dec = [-90, 0, 90]
ra = [self.proj.ra_0,] * 3
jac = np.sum(self.proj.gradient(ra, dec)**2, axis=1)
p = dec[np.argmax(jac)]
# remove outer meridians to prevent overlap with parallel label
if p == 0 and self.proj.ra_0 % sep == 0:
_meridians = _meridians[1:-1]