本文整理汇总了Python中matplotlib.path.Path.interpolated方法的典型用法代码示例。如果您正苦于以下问题:Python Path.interpolated方法的具体用法?Python Path.interpolated怎么用?Python Path.interpolated使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类matplotlib.path.Path
的用法示例。
在下文中一共展示了Path.interpolated方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: transform_path_non_affine
# 需要导入模块: from matplotlib.path import Path [as 别名]
# 或者: from matplotlib.path.Path import interpolated [as 别名]
def transform_path_non_affine(self, path):
# Adaptive interpolation:
# we keep adding control points, till all control points
# have an error of less than 0.01 (about 1%)
# or if the number of control points is > 80.
ra0 = self.ra0
path = path.cleaned(curves=False)
v = path.vertices
diff = v[:, 0] - v[0, 0]
v00 = v[0][0] - ra0
while v00 > 180: v00 -= 360
while v00 < -180: v00 += 360
v00 += ra0
v[:, 0] = v00 + diff
nonstop = path.codes > 0
path = Path(v[nonstop], path.codes[nonstop])
isteps = path._interpolation_steps * 2
while True:
ipath = path.interpolated(isteps)
tiv = self.transform(ipath.vertices)
itv = Path(self.transform(path.vertices)).interpolated(isteps).vertices
if np.mean(np.abs(tiv - itv)) < 0.01:
break
if isteps > 20:
break
isteps = isteps * 2
return Path(tiv, ipath.codes)
示例2: Path
# 需要导入模块: from matplotlib.path import Path [as 别名]
# 或者: from matplotlib.path.Path import interpolated [as 别名]
plot_data[cell.y - 1][cell.x - 1] = (cell[0] - cell[1])
figure, axis = plot.subplots(figsize=(6, 7))
newset = trackset.get_tracks_random(1)
max_biomass = numpy.amax(newset.biomasses())
track = newset[0]
area = numpy.pi * (5)**2 # dot radius of 5
plot.scatter(track.x[0]/25, track.y[0]/25, c="green", s=area, zorder=3)
plot.scatter(track.x[-1]/25, track.y[-1]/25, c="red", s=area, zorder=3)
path = Path(numpy.column_stack([track.x/25, track.y/25]))
verts = path.interpolated(steps=3).vertices
x, y = verts[:, 0], verts[:, 1]
data = numpy.true_divide(track.biomasses, max_biomass)
axis.add_collection(colorline(x, y, data))
axis.set_title("Lifetime - Biomass")
axis.set_xlim([0, 100])
axis.set_ylim([0, 100])
figure.subplots_adjust(bottom=0.235)
colorbar_axis = figure.add_axes([0.15, .12, .73, .05])
grid_image = axis.imshow(plot_data, interpolation='none', origin="lower", cmap=plot.get_cmap("Blues_r"), vmin=-1, vmax=1, extent=[0, 100, 0, 100], aspect="equal")
colorbar = plot.colorbar(grid_image, cax=colorbar_axis, orientation='horizontal')
colorbar.set_ticks([-1, 0, 1])
colorbar.set_ticklabels([-1, 0, 1])