本文整理汇总了Python中matplotlib.patches.Circle.set_fill方法的典型用法代码示例。如果您正苦于以下问题:Python Circle.set_fill方法的具体用法?Python Circle.set_fill怎么用?Python Circle.set_fill使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类matplotlib.patches.Circle
的用法示例。
在下文中一共展示了Circle.set_fill方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: add_breadcrumb
# 需要导入模块: from matplotlib.patches import Circle [as 别名]
# 或者: from matplotlib.patches.Circle import set_fill [as 别名]
def add_breadcrumb(self):
""" Adds a breadcrumb """
c = Circle(self._loc, radius = 16.25)
c.set_facecolor('0.65') # grey
c.set_edgecolor('black')
c.set_zorder(zorders['breadcrumbs'])
c.set_fill(True)
self.view.add_artist(c)
self.breadcrumbs.append(c)
self.draw()
示例2: add_danger
# 需要导入模块: from matplotlib.patches import Circle [as 别名]
# 或者: from matplotlib.patches.Circle import set_fill [as 别名]
def add_danger(self, danger_id):
""" Appends a new danger to the appropriate list of `env`, and updates
the `env` view. The position at which the danger is placed is computed
based on the rover's location and direction, but also where on the
robot that particular danger-detection sensor is located. """
"""if danger_id == left_bumper:
elif danger_id == right_bumper:
elif danger_id == left_and_right_bumper:
elif danger_id == front_left_cliff:
elif danger_id == front_right_cliff:
elif danger_id == left_cliff:
elif danger_id == right_cliff:
elif danger_id == white_tape_front_left:
elif danger_id == white_tape_front_right:
elif danger_id == white_tape_left:
elif danger_id == white_tape_right:
elif danger_id == left_wheel:
elif danger_id == right_wheel:
elif danger_id == middle_wheel:
else:
raise NotImplementedError()
"""
# Find the danger location using `danger_angle` and `danger_distance`
# TODO: maybe later
# danger_loc = conv_radial(self, danger_theta, danger_r)
# Plot
if (1 <= danger_id <= 3): # Bumper range in OIStopID
""" Adds a bump """
c = Circle(self._loc, radius = 6.25)
c.set_facecolor('0.65') # grey
c.set_edgecolor('black')
c.set_zorder(zorders['bumps'])
c.set_fill(True)
self.view.add_artist(c)
self.bumps.append(c)
self.draw()
elif (4 <= danger_id <= 7): # Cliff range in OIStopID
""" Adds a cliff """
c = Circle(self._loc, radius = 6.25)
c.set_facecolor('0.65') # grey
c.set_edgecolor('black')
c.set_zorder(zorders['cliffs'])
c.set_fill(True)
self.view.add_artist(c)
self.cliffs.append(c)
self.draw()
elif (12 <= danger_id <= 14): # Drop range in OIStopID
""" Adds a drop """
c = Circle(self._loc, radius = 6.25)
c.set_facecolor('0.65') # grey
c.set_edgecolor('black')
c.set_zorder(zorders['drops'])
c.set_fill(True)
self.view.add_artist(c)
self.drops.append(c)
self.draw()
elif (8 <= danger_id <= 11): # White tape range in OIStopID
""" Adds tape """
c = Circle(self._loc, radius = 6.25)
c.set_facecolor('0.65') # grey
c.set_edgecolor('black')
c.set_zorder(zorders['tape'])
c.set_fill(True)
self.view.add_artist(c)
self.tape.append(c)
self.draw()
else:
raise NotImplementedError()
# The following is the temporary workaround:
sys.stderr.write("danger found: " + str(danger_id)) # TODO: check to see if enum strig is a thing
示例3: gen_png
# 需要导入模块: from matplotlib.patches import Circle [as 别名]
# 或者: from matplotlib.patches.Circle import set_fill [as 别名]
def gen_png(*args):
if len(args) == 1:
if len(args[0]) == 4:
res = args[0][0]
f_name = args[0][1]
extension = args[0][2]
header_lines = args[0][3]
elif len(args) == 4:
res = args[0]
f_name = args[1]
extension = args[2]
header_lines = args[3]
else:
print "Wrong number or type of arguments, aborting"
return (-1)
data = np.loadtxt(f_name+extension, skiprows=header_lines)
header = np.genfromtxt(f_name+extension, max_rows=4)
fig = plt.figure()
ax = fig.add_subplot(111, projection='3d')
global t
t += header[-1]
dt = header[-1]
to_delete = []
for i in range(0, data.shape[0]):
if (data[i,1] < 0 and data[i,0] >0):
to_delete.append(i)
data = np.delete(data, to_delete, axis=0)
rho = data[::res,-2]
norm_rho = np.zeros(rho.shape)
# print np.amin(rho), np.amax(rho)
for i in range(0, np.shape(rho)[0]):
norm_rho[i] = (rho[i]-np.amin(rho))/(np.amax(rho)-np.amin(rho))
# print np.amin(rho), np.amax(rho), rho
# print np.amin(norm_rho), np.amax(norm_rho), norm_rho
norm = LogNorm(vmin=np.amin(rho), vmax=np.amax(rho), clip=False)
radius = np.amax(data[::res,2])
circle1 = Circle((0,0), radius)
circle1.set_fill(True)
circle1.set_edgecolor('red')
circle1.set_fc('grey')
circle1.set_alpha(0.5)
ax.add_patch(circle1)
art3d.pathpatch_2d_to_3d(circle1, z=0, zdir="y")
s = ax.scatter(data[::res,0], data[::res,1], data[::res,2], norm=norm, cmap='hot', c=rho, marker='.')
ax.text2D(0.05, 0.95, '{} myr; {} myr'.format(t,dt), transform=ax.transAxes)
ax.set_ylim(ax.get_xlim())
ax.set_xlabel('x')
ax.set_ylabel('y')
ax.set_zlabel('z')
fig.colorbar(s, shrink=0.5, aspect=5)
# circle2 = Circle((0,0), radius)
# circle2.set_fill(False)
# circle2.set_edgecolor('red')
# ax.add_patch(circle2)
# art3d.pathpatch_2d_to_3d(circle2, z=0, zdir="x")
plt.savefig(f_name+'.png', dpi=300, papertype='a4')
#plt.show()
plt.close(fig)
return (f_name, 0)