本文整理汇总了Python中matplotlib.patches.Circle.set_fc方法的典型用法代码示例。如果您正苦于以下问题:Python Circle.set_fc方法的具体用法?Python Circle.set_fc怎么用?Python Circle.set_fc使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类matplotlib.patches.Circle
的用法示例。
在下文中一共展示了Circle.set_fc方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: animate
# 需要导入模块: from matplotlib.patches import Circle [as 别名]
# 或者: from matplotlib.patches.Circle import set_fc [as 别名]
def animate(currentNode = currentNode):
while 1:
newNode = q.get()
if currentNode: currentNode.remove()
circle = Circle(newNode,0.1)
currentNode = ax.add_patch(circle)
circle.set_fc('r')
fig.canvas.draw()
示例2: gen_png
# 需要导入模块: from matplotlib.patches import Circle [as 别名]
# 或者: from matplotlib.patches.Circle import set_fc [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)