本文整理汇总了Python中matplotlib.patches.Ellipse.set_fc方法的典型用法代码示例。如果您正苦于以下问题:Python Ellipse.set_fc方法的具体用法?Python Ellipse.set_fc怎么用?Python Ellipse.set_fc使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类matplotlib.patches.Ellipse
的用法示例。
在下文中一共展示了Ellipse.set_fc方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: plot_cluster_pos
# 需要导入模块: from matplotlib.patches import Ellipse [as 别名]
# 或者: from matplotlib.patches.Ellipse import set_fc [as 别名]
def plot_cluster_pos(ecc, fname):
a = 1
b = a*(1-ecc)/(1+ecc)
xe = 0
ye = -a*ecc
e = Ellipse((0,0), 2*b, 2*a)
phi = pi/4 - pi/10
xc = b*cos(phi)
yc = a*sin(phi)
fig = plt.figure()
ax = fig.add_subplot(111)
ax.set_aspect('equal')
ax.add_patch(e)
e.set_clip_box(ax.bbox)
e.set_facecolor([1,1,1])
e.set_ec('w')
e.set_fc('none')
e.set_lw(1)
plt.plot(xc,yc,'ow',ms = 10)
plt.text(xc-0.1, yc-0.2, 'Cluster',fontsize = 11,color = 'w')
plt.plot(xe,ye,'ow',ms = 10)
plt.text(xe-0.5, ye - 0.2, 'Galactic Center',fontsize = 11,color = 'w')
dphi = pi/40
plt.arrow(b*cos(phi+dphi),
a*sin(phi+dphi),
-b*sin(phi+dphi)*0.0001,
a*cos(phi+dphi)*0.0001,
width = 0.001,
head_width = 0.04,
head_starts_at_zero = True,
fill = False,
overhang = 0.9,
color = 'w')
phis = pi/2
xs = xc + cos(phis)*a/5.
ys = yc + sin(phis)*a/5.
plt.plot(xs, ys, '*w', ms = 10)
plt.text(xs-0.1, ys+0.1, 'Star',fontsize = 11,color = 'w')
plt.plot([xe,xc],[ye,yc],'--w')
plt.text((b*cos(phi)*0.5)*0.6+0.1, (a*sin(phi)*0.1-0.05), '$\mathbf{R}$',color = 'w')
plt.plot([xe,xs],[ye,ys],'--w')
plt.text((xs+xe)/2, (ys+ye)/2+0.1, '$\mathbf{x}$',color = 'w')
plt.plot([xc,xs],[yc,ys],':w')
plt.text((xc+xs)/2+0.05, (yc+ys)/2-0.01, '$\mathbf{r}$',color = 'w')
plt.arrow(xc, yc, (xc-xe)*.5, (yc-ye)*.5,
color = 'w', width = 0.001, head_width = 0.03)
plt.arrow(xc, yc, -(yc-ye)*.5, (xc-xe)*.5,
color = 'w', width = 0.001, head_width = 0.03)
plt.text(xc + (xc-xe)*.5+0.03, yc + (yc-ye)*.5 - 0.02, '$x$',color = 'w')
plt.text(xc - (yc-ye)*.5-0.05, yc + (xc-xe)*.5+0.05, '$y$',color = 'w')
ax.set_ylim((ye-(1-ecc)*a)*1.4, (ye+(1+ecc)*a)*1.4)
ax.set_xlim(-a*1.4, a*1.4)
ax.get_xaxis().set_visible(False)
ax.get_yaxis().set_visible(False)
ax.set_frame_on(False)
set_foregroundcolor(ax,'w')
set_backgroundcolor(ax,'k')
plt.savefig(fname, bbox_inches = 'tight',transparent = True)