本文整理汇总了Python中matplotlib.patches.PathPatch.set_zorder方法的典型用法代码示例。如果您正苦于以下问题:Python PathPatch.set_zorder方法的具体用法?Python PathPatch.set_zorder怎么用?Python PathPatch.set_zorder使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类matplotlib.patches.PathPatch
的用法示例。
在下文中一共展示了PathPatch.set_zorder方法的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: hash_fill_between
# 需要导入模块: from matplotlib.patches import PathPatch [as 别名]
# 或者: from matplotlib.patches.PathPatch import set_zorder [as 别名]
def hash_fill_between(ax, x, y1, y2=0, **kargs):
''' For x, hash region between y1 and y2. Equivalent of ax.fill_between '''
p = ax.fill_between(x, y1, y2, **kargs)
p.set_facecolors("none")
p.set_edgecolors("none")
for path in p.get_paths():
p1 = PathPatch(path, fc="none", hatch="//", alpha=1)
ax.add_patch(p1)
p1.set_zorder(p.get_zorder() - 0.1)
示例2: profiles_rigid_vs_el_mtrx
# 需要导入模块: from matplotlib.patches import PathPatch [as 别名]
# 或者: from matplotlib.patches.PathPatch import set_zorder [as 别名]
def profiles_rigid_vs_el_mtrx():
r = 0.003
tau = 0.3
V_f = 0.11
E_f = 200e3
E_m = 25e10
Ll = 35.
Lr = 35.
Xxi = RV('weibull_min', shape=5., scale=.02)
Xr = RV('uniform', loc=.002, scale=.002)
Xtau = RV('uniform', loc=.02, scale=.98)
reinf2 = Reinforcement(r=Xr, tau=Xtau, V_f=V_f, E_f=E_f, xi=Xxi, n_int=15)
model2 = CompositeCrackBridge(E_m=E_m, reinforcement_lst=[reinf2], Ll=Ll, Lr=Lr)
ccb_view2 = CompositeCrackBridgeView(model=model2)
ccb_view2.sigma_c_max
x2 = np.hstack((-Ll, ccb_view2.x_arr, Lr))
mu_epsf2 = np.hstack((ccb_view2.mu_epsf_arr[0], ccb_view2.mu_epsf_arr, ccb_view2.mu_epsf_arr[-1]))
epsm2 = np.hstack((ccb_view2.epsm_arr[0], ccb_view2.epsm_arr, ccb_view2.epsm_arr[-1]))
fig = plt.figure()
ax = fig.add_subplot(1, 1, 1)
ax.plot(x2, mu_epsf2, lw=2, color='black')
ax.plot(x2, epsm2, lw=2, color='black')
p = ax.fill_between(x2, epsm2, mu_epsf2, facecolor='none')
from matplotlib.patches import PathPatch
path = p.get_paths()[0]
p1 = PathPatch(path, fc="none", hatch="/")
ax.add_patch(p1)
p1.set_zorder(p.get_zorder()-0.1)
p = ax.fill_between(x2, mu_epsf2, facecolor='none')
path = p.get_paths()[0]
p1 = PathPatch(path, fc="none", hatch="\\")
ax.add_patch(p1)
p1.set_zorder(p.get_zorder()-0.1)
reinf1 = Reinforcement(r=r, tau=tau, V_f=V_f, E_f=E_f, xi=Xxi, n_int=15)
model1 = CompositeCrackBridge(E_m=E_m, reinforcement_lst=[reinf1], Ll=Ll, Lr=Lr)
ccb_view1 = CompositeCrackBridgeView(model=model1)
ccb_view1.sigma_c_max
x1 = np.hstack((-Ll, ccb_view1.x_arr, Lr))
mu_epsf1 = np.hstack((ccb_view1.mu_epsf_arr[0], ccb_view1.mu_epsf_arr, ccb_view1.mu_epsf_arr[-1]))
epsm1 = np.hstack((ccb_view1.epsm_arr[0], ccb_view1.epsm_arr, ccb_view1.epsm_arr[-1]))
ax.plot(x1, mu_epsf1, lw=2, color='black')
ax.plot(x1, epsm1, lw=2, color='black')
plt.xlabel('z [mm]')
plt.xlim(-35, 35)
plt.ylim(0)
plt.ylabel('$\epsilon$ [-]')
示例3: getResPatchInPrb
# 需要导入模块: from matplotlib.patches import PathPatch [as 别名]
# 或者: from matplotlib.patches.PathPatch import set_zorder [as 别名]
def getResPatchInPrb(self, n__PRB:int):
"""
get pathPatches for plot res in dedicate Prb
:return:
"""
codes = []
vertices = []
for re in self.prb(n__PRB)().res:
codes += re().codes
vertices += re().vertices
path = Path(vertices, codes)
pathPatch = PathPatch(path, facecolor='white', edgecolor='black', linewidth=0.2, linestyle='dotted', fill='none')
pathPatch.set_zorder(9)
return pathPatch
示例4: getResPatchInReg
# 需要导入模块: from matplotlib.patches import PathPatch [as 别名]
# 或者: from matplotlib.patches.PathPatch import set_zorder [as 别名]
def getResPatchInReg(self, k___singleQuote:int, l___singleQuote:int):
"""
get pathPatches for plot res in dedicate Prb
:return:
"""
codes = []
vertices = []
for re in self.reg(k___singleQuote,l___singleQuote).res:
codes += re().codes
vertices += re().vertices
path = Path(vertices, codes)
patch = PathPatch(path, facecolor='white', edgecolor='black', linewidth=0.2, linestyle='dotted', fill='none')
patch.set_zorder(90)
return patch
示例5: _initPatch
# 需要导入模块: from matplotlib.patches import PathPatch [as 别名]
# 或者: from matplotlib.patches.PathPatch import set_zorder [as 别名]
def _initPatch(self):
"""
get pathPatches for plotting res for CRS of dedicate port
:return:
"""
codes = []
vertices = []
for re in self.res:
codes += re().codes
vertices += re().vertices
path = Path(vertices, codes)
patch = PathPatch(path, facecolor='white', edgecolor='black', linewidth=0.2, fill='none')
patch.set_zorder(90)
return patch, codes, vertices
示例6: _initPatch
# 需要导入模块: from matplotlib.patches import PathPatch [as 别名]
# 或者: from matplotlib.patches.PathPatch import set_zorder [as 别名]
def _initPatch(self, n__s:int, subFrameTypeName:str):
"""
generate path patch for this PRB
:param n__s:
:param subFrameTypeName:
:return:
"""
vertices = []
codes = []
bottom = 0
left = 0
width = 0
height = 0
if subFrameTypeName == 'D':
bottom = self.n__PRB * conf.N__sc___RB_DL
left = 0
width = conf.N__symb___DL
height = conf.N__sc___RB_DL
if subFrameTypeName == 'U':
bottom = self.n__PRB * conf.N__sc___RB_UL
left = 0
width = conf.N__symb___UL
height = conf.N__sc___RB_UL
if subFrameTypeName == 'S':
if n__s %1 == 0:
bottom = self.n__PRB * conf.N__sc___RB_DL
left = 0
width = conf.N__symb___DwPTS
height = conf.N__sc___RB_DL
if n__s %1 == 1:
bottom = self.n__PRB * conf.N__sc___RB_UL
left = conf.N__symb___UpPTS
width = conf.N__symb___UL - conf.N__symb___DwPTS
height = conf.N__sc___RB_UL
codes = [Path.MOVETO] + [Path.LINETO]*3 + [Path.CLOSEPOLY]
vertices = [(left,bottom),
(left,bottom+height),
(left+width,bottom+height),
(left+width,bottom),
(0,0)]
path = Path(vertices, codes)
patch = PathPatch(path, facecolor='white', edgecolor='black', linewidth=2.0, fill='none' )
patch.set_zorder(80)
return patch, codes, vertices
示例7: initPatch
# 需要导入模块: from matplotlib.patches import PathPatch [as 别名]
# 或者: from matplotlib.patches.PathPatch import set_zorder [as 别名]
def initPatch(self):
"""
plot based on matplotlib
:return:
"""
vertices = []
codes = []
codes = [Path.MOVETO] + [Path.LINETO]*3 + [Path.CLOSEPOLY]
vertices = [(self.l,self.k),
((self.l),(self.k+1)),
((self.l+1),(self.k+1)),
((self.l+1),(self.k)),
(0,0)]
path = Path(vertices, codes)
patch = PathPatch(path, facecolor='white', edgecolor='black')
patch.set_zorder(100)
return patch, codes,vertices
示例8: _initPatch
# 需要导入模块: from matplotlib.patches import PathPatch [as 别名]
# 或者: from matplotlib.patches.PathPatch import set_zorder [as 别名]
def _initPatch(self):
"""
generate path patch for this SLOT
:param n:
:param subFrameTypeName:
:return:
"""
vertices = []
codes = []
vertices += self.slots[0].vertices
codes += self.slots[0].codes
vertices += self.slots[1].vertices
codes += self.slots[1].codes
path = Path(vertices, codes)
patch = PathPatch(path, facecolor='white', edgecolor='black', linewidth=2.0, fill='none' )
patch.set_zorder(60)
return patch, codes, vertices
示例9: _render_on_subplot
# 需要导入模块: from matplotlib.patches import PathPatch [as 别名]
# 或者: from matplotlib.patches.PathPatch import set_zorder [as 别名]
def _render_on_subplot(self, subplot):
"""
Render this Bezier path in a subplot. This is the key function that
defines how this Bezier path graphics primitive is rendered in matplotlib's
library.
TESTS::
sage: bezier_path([[(0,1),(.5,0),(1,1)]])
Graphics object consisting of 1 graphics primitive
::
sage: bezier_path([[(0,1),(.5,0),(1,1),(-3,5)]])
Graphics object consisting of 1 graphics primitive
"""
from matplotlib.patches import PathPatch
from matplotlib.path import Path
from sage.plot.misc import get_matplotlib_linestyle
options = dict(self.options())
del options['alpha']
del options['thickness']
del options['rgbcolor']
del options['zorder']
del options['fill']
del options['linestyle']
bpath = Path(self.vertices, self.codes)
bpatch = PathPatch(bpath, **options)
options = self.options()
bpatch.set_linewidth(float(options['thickness']))
bpatch.set_fill(options['fill'])
bpatch.set_zorder(options['zorder'])
a = float(options['alpha'])
bpatch.set_alpha(a)
c = to_mpl_color(options['rgbcolor'])
bpatch.set_edgecolor(c)
bpatch.set_facecolor(c)
bpatch.set_linestyle(get_matplotlib_linestyle(options['linestyle'], return_type='long'))
subplot.add_patch(bpatch)
示例10: draw
# 需要导入模块: from matplotlib.patches import PathPatch [as 别名]
# 或者: from matplotlib.patches.PathPatch import set_zorder [as 别名]
def draw(fig, h, heid, row):
ax = plt.subplot2grid(shape=(2,5), loc=(row,0), colspan=2)
lbls = labels_count if row==1 else [_]
ax.set_xticklabels(lbls)
for t in ax.xaxis.get_major_ticks():
t.label.set_rotation(30)
rplt.hist(h, axes=ax)
npass = sum(list(h)[2:])
p = plt.fill_between([1.5,4.5],[npass,npass], [0.01,0.01])
p.set_facecolors('none')
for path in p.get_paths():
p1 = PathPatch(path, fc='none', hatch='\\\\\\', color='blue')
ax.add_patch(p1)
p1.set_zorder(p.get_zorder()-0.1)
ax.set_yscale('log')
ylim((0.01,3*h.GetMaximum()))
text(0.9, 0.75,'charge skim', fontsize=12, color='blue',
transform=ax.transAxes, horizontalalignment='right', verticalalignment='bottom')
text(0.9, 0.68, '%.1f'%(100*npass)+'$\%$', fontsize=14, color='blue',
transform=ax.transAxes, horizontalalignment='right', verticalalignment='top')
ax = plt.subplot2grid(shape=(2,5), loc=(row,2), colspan=3)
lbls = labels_eid if row==1 else [_]
ax.set_xticklabels(lbls)
for t in ax.xaxis.get_major_ticks():
t.label.set_rotation(30)
rplt.hist(heid, axes=ax)
X = [0.5,6.5]
Y1 = [npass,npass]
Y2 = [heid.GetMinimum(), heid.GetMinimum()]
# plot(X, Y2, 'r-.')
p = plt.fill_between([0.5,1.5],[npass,npass])
p.set_facecolors('none')
for path in p.get_paths():
p1 = PathPatch(path, fc='none', hatch='\\\\\\', color='blue')
ax.add_patch(p1)
p1.set_zorder(p.get_zorder()-0.1)
p = plt.fill_between([5.5,6.5],Y2)
p.set_facecolors('none')
for path in p.get_paths():
p1 = PathPatch(path, fc='none', hatch='xxx', color='green')
ax.add_patch(p1)
p1.set_zorder(p.get_zorder()-0.1)
ylim((0.5*heid.GetMinimum(),1.1*heid.GetMaximum()))
text(0.95, 0.75, 'refined electron\nidentification', fontsize=12, color='green',
transform=ax.transAxes, horizontalalignment='right', verticalalignment='bottom')
text(0.95, 0.68, '%.1f'%(100*heid.GetMinimum())+'$\%$', fontsize=14, color='green',
transform=ax.transAxes, horizontalalignment='right', verticalalignment='top')
# subplots_adjust(bottom=0.5, wspace=0.6, hspace=0.1)
subplots_adjust(left=0.1, bottom=0.15, wspace=0.6, hspace=0.1)
if row==1: # text(0,-0.0025,'selection criteria', fontsize=12)
text(0.5,0,'selection criteria', fontsize=12, transform=fig.transFigure, horizontalalignment='center')
text(0, 0.5, 'events per trigger', fontsize=12, transform=fig.transFigure, verticalalignment='center', rotation=90)
示例11: _initPatch
# 需要导入模块: from matplotlib.patches import PathPatch [as 别名]
# 或者: from matplotlib.patches.PathPatch import set_zorder [as 别名]
def _initPatch(self, n__s:int, subFrameTypeName:str):
"""
generate path patch for this SLOT
:param n__s:
:param subFrameTypeName:
:return:
"""
vertices = []
codes = []
bottom = 0
left = 0
width = 0
height = 0
if subFrameTypeName == 'D':
bottom = 0
left = 0
width = conf.N__symb___DL
height = conf.N__RB___DL*conf.N__sc___RB_DL
if subFrameTypeName == 'U':
bottom = 0
left = 0
width = conf.N__symb___UL
height = conf.N__RB___UL * conf.N__sc___RB_UL
if subFrameTypeName == 'S':
if n__s %2 == 0:
bottom = 0
left = 0
if conf.N__symb___DwPTS > conf.N__symb___DL:
width = conf.N__symb___DL
height = conf.N__RB___DL*conf.N__sc___RB_DL
if n__s %2 == 1:
if (conf.N__symb___GP + conf.N__symb___UpPTS) < conf.N__symb___UL:
#extended DwPTS in second slot region
bottom = 0
left = 0
width = conf.N__symb___UL - conf.N__symb___UpPTS - conf.N__symb___GP
height = conf.N__RB___UL*conf.N__sc___RB_UL
codes = [Path.MOVETO] + [Path.LINETO]*3 + [Path.CLOSEPOLY]
vertices = [(left,bottom),
(left,bottom+height),
(left+width,bottom+height),
(left+width,bottom),
(0,0)]
if subFrameTypeName == 'S':
if n__s %2 == 1:
bottom = 0
left = conf.N__symb___UL - conf.N__symb___UpPTS
width = conf.N__symb___UpPTS
height = conf.N__RB___UL*conf.N__sc___RB_UL
codes += [Path.MOVETO] + [Path.LINETO]*3 + [Path.CLOSEPOLY]
vertices += [(left,bottom),
(left,bottom+height),
(left+width,bottom+height),
(left+width,bottom),
(0,0)]
path = Path(vertices, codes)
patch = PathPatch(path, facecolor='white', edgecolor='black', linewidth=3.0, fill='none' )
patch.set_zorder(60)
return patch, codes, vertices
示例12: plot_hourly_generation_alt
# 需要导入模块: from matplotlib.patches import PathPatch [as 别名]
# 或者: from matplotlib.patches.PathPatch import set_zorder [as 别名]
def plot_hourly_generation_alt(ISO='DK', gamma=0.5, alpha_w=.5, CS=None, date_start=datestr2num('1-1-2000'), N_days=30, monday_offset=5, titletxt='Denmark, Jan. 2000', label='TestFigure'):
#Load data
t, L, Gw, Gs, datetime_offset, datalabel = get_ISET_country_data(ISO)
mask = find((t+datetime_offset>=date_start)*(t+datetime_offset<=date_start+N_days))
if alpha_w==None:
alpha_w = get_optimal_mix_balancing(L, Gw, Gs, gamma)
print 'Mix not specified. Optimal mix alpha_w={0} chosen'.format(alpha_w)
wind = gamma*alpha_w*Gw*mean(L)
solar = gamma*(1-alpha_w)*Gs*mean(L)
mismatch = (wind+solar) - L
if CS!=None or CS==0:
mismatch_r = get_policy_2_storage(mismatch, eta_in = 1., eta_out = 1., storage_capacity = CS)[0]
else:
mismatch_r = mismatch
curtailment = get_positive(mismatch_r)
filling = get_positive(mismatch - mismatch_r)
extraction = get_positive(-(mismatch - mismatch_r))
wind_local = wind - (curtailment+filling)*wind/(wind+solar+1e-10)
solar_local = solar - (curtailment+filling)*solar/(wind+solar+1e-10)
#Set plot options
matplotlib.rcParams['font.size'] = 10
close(1); figure(1); clf()
gcf().set_dpi(300)
gcf().set_size_inches([6.5,4.3])
fill_between(t[mask],wind_local[mask],color=color_wind,edgecolor=color_edge,lw=1)
fill_between(t[mask],wind_local[mask]+solar_local[mask],wind_local[mask],color=color_solar,edgecolor=color_edge,lw=1)
p = fill_between(t[mask],wind_local[mask]+solar_local[mask]+filling[mask],wind_local[mask]+solar_local[mask],color='g',edgecolor=color_edge,lw=1)
fill_between(t[mask],wind_local[mask]+solar_local[mask]+extraction[mask],wind_local[mask]+solar_local[mask],color='g',edgecolor=color_edge,lw=1)
fill_between(t[mask],wind_local[mask]+solar_local[mask]+filling[mask]+curtailment[mask],wind_local[mask]+solar_local[mask]+filling[mask],color='r',edgecolor=color_edge,lw=1)
p.set_facecolors("none")
from matplotlib.patches import PathPatch
for path in p.get_paths():
p1 = PathPatch(path, fc="none", hatch="/")
gca().add_patch(p1)
p1.set_zorder(p.get_zorder()-0.1)
pp_wind = Rectangle((0, 0), 1, 1, facecolor=color_wind)
pp_solar = Rectangle((0, 0), 1, 1, facecolor=color_solar)
pp_curtailment = Rectangle((0, 0), 1, 1, facecolor='r')
pp_storage = Rectangle((0, 0), 1, 1, facecolor='g')
pp_filling = Rectangle((0, 0), 1, 1, facecolor='none', hatch="/")
pp_load = plot(t[mask],L[mask],color='k',lw=1.5)
axis(xmin=t[mask[0]],xmax=t[mask[-1]],ymin=0,ymax=1.9*mean(L))
ylabel('Power [GW]')
day_names = array([calendar.day_abbr[mod(i,7)] for i in arange(N_days)+monday_offset])
#day_names[find([d!='Mon' for d in day_names])] = ''
xticks(t[mask[0]]+arange(N_days),day_names,rotation=-45,ha='left')
if CS==None:
pp = [pp_load[0],pp_wind,pp_solar,pp_curtailment]
txtlabels = ['Load ({0})'.format(ISO),'Wind','Solar','Surplus']
leg = legend(pp,txtlabels,loc='upper left',ncol=5,title=titletxt);
else:
pp = [pp_load[0],pp_filling,pp_wind,pp_curtailment,pp_solar,pp_storage]
txtlabels = ['Load ({0})'.format(ISO),'Stored surplus','Wind','Remainder surplus','Solar','Storage']
leg = legend(pp,txtlabels,loc='upper left',ncol=4,title=titletxt);
ltext = leg.get_texts();
setp(ltext, fontsize='small') # the legend text fontsize
tight_layout()
save_file_name = 'plot_hourly_generation_alt_'+ISO+'_'+label+'.pdf'
save_figure(save_file_name)
示例13: PathPatch
# 需要导入模块: from matplotlib.patches import PathPatch [as 别名]
# 或者: from matplotlib.patches.PathPatch import set_zorder [as 别名]
x0, x1 = plt.xlim()
xr, yr = x1-x0, y1-y0
plt.text(x0+0.183*xr, y0+0.85*yr, r'$W = [%.3f, %.3f)\,\mathrm{GeV}$'%(wlo,whi),
fontsize=16, horizontalalignment='left', verticalalignment='bottom')
plt.text(x0+0.175*xr, y0+0.725*yr, r'$Q^2 = [%.3f, %.3f)\,\mathrm{GeV^2}$'%(q2lo,q2hi),
fontsize=16, horizontalalignment='left', verticalalignment='bottom')
f3 = h.GetListOfFunctions()[2]
X = np.linspace(-1,1, num=500)
Y = [f3.Eval(x) for x in X]
# plt.plot(X,Y,'.r')
p = plt.fill_between(X, 0, Y)
p.set_facecolors('none')
for path in p.get_paths():
p1 = PathPatch(path, fc='none', hatch='\\\\\\', color='red')
sp.add_patch(p1)
p1.set_zorder(p.get_zorder()-0.1)
f1 = h.GetListOfFunctions()[0]
Y = [f1.Eval(x) for x in X]
plt.plot(X,Y,'-k')
f2 = h.GetListOfFunctions()[1]
Y = [f2.Eval(x) for x in X]
plt.plot(X,Y,'--b', lw=2)
plt.tight_layout()
plt.text(-5.5,2600,'PRELIMINARY',fontsize=108,rotation=30,alpha=0.175)
plt.text(-3.75,1600,'PRELIMINARY',fontsize=108,rotation=30,alpha=0.175)
plt.savefig('cost_samples_tmp.pdf')
plt.savefig('cost_samples_tmp.eps')
# <codecell>
dfm = pd.read_table('/home/ephelps/Dropbox/Notebooks/omega/Projects/Omega/Cross-sections/Morand/xsect_integrated_morand.txt')