当前位置: 首页>>代码示例>>Python>>正文


Python PdfPages.clsoe方法代码示例

本文整理汇总了Python中matplotlib.backends.backend_pdf.PdfPages.clsoe方法的典型用法代码示例。如果您正苦于以下问题:Python PdfPages.clsoe方法的具体用法?Python PdfPages.clsoe怎么用?Python PdfPages.clsoe使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在matplotlib.backends.backend_pdf.PdfPages的用法示例。


在下文中一共展示了PdfPages.clsoe方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: make_plot_conditional_nH_T

# 需要导入模块: from matplotlib.backends.backend_pdf import PdfPages [as 别名]
# 或者: from matplotlib.backends.backend_pdf.PdfPages import clsoe [as 别名]
def make_plot_conditional_nH_T(denArr, tempArr, m_GArr, m_JArr, fignamestr, bin_by_mgrp = True, nbins = 10, nptcl_each = 0, propArr=[], ncolor=5):

	if fignamestr[0].find("max") != -1:
		ylabel = r"$M_J^{max}$"
	elif fignamestr[0].find("peak") != -1: 
		ylabel = r"$M_J^{peak}$" 
	else:
		ylabel = r"$M_J(%s)$" % fignamestr[0][2:]

		mrange_x = [0.9*N.min(m_GArr), 1.1*N.max(m_GArr)]
		mrange_y = [0.9*N.min(m_JArr), 1.1*N.max(m_JArr)]

	ii = N.where(m_yArr < m_xArr)[0]
	print ii

	## make seperate plot

	if len(ii) > 0 and len(propArr) > 0:
		## choose the color based on the density
		id_clprop, clprop_bins, colorArr = color_by_prop(propArr[ii], ncolor)

		fig = plt.figure(2)
		figname = "n_H-T_%s_ov%d_vr%d_%sLTmG_eqN%s_%sclr.pdf" % (fignamestr[1], int(simI["over_density"]), simI["virial_radius"], fignamestr[0], int(bin_by_mass))
		figpp = PdfPages(figname)

		nrow = 2; ncol = 2; nplt = nrow*ncol
		pltkwarg = dict(linestyle="--", marker="o", ms=5., mew=0., alpha=0.7, mec="none")

		for icl, idx in enumerate(ii):
			iplt = icl % nplt

			if iplt == 0:
				plt.clf()

			ax = fig.add_subplot(2, 2, iplt + 1)
			pltkwarg["color"] = colorArr[id_clprop[icl]]
			ax.plot(xArr[idx, :], yArr[idx, :], **pltkwarg)
			ax.plot(xArr[idx, -1], yArr[idx, -1], "k+", ms=6.)
			ax.set_xscale("log"); ax.set_yscale("log")
			#ax.set_xlim([1.e-5, 1.e-1]); ax.set_ylim([8.e3, 1.2e5])
			ax.set_xlim(N.min(xArr[ii, :]), N.max(xArr[ii, :]))
			ax.set_ylim(N.min(yArr[ii, :]), N.max(yArr[ii, :]))
			ax.set_xlabel(r"$n_H$"); ax.set_ylabel(r"$T$")

			if iplt == 3:
				figpp.savefig()

		figpp.clsoe()

	## plot in one panel
	elif len(ii) > 0 and len(ii) <= 30:
		fig = plt.figure(2)
		plt.clf()
		ax = fig.add_subplot(111)
		colorArr = []
		for icl in xrange(len(ii)):
			colorArr.append(plt.get_cmap("hsv")(float(icl)/(len(ii))))

		pltkwarg = dict(linestyle="--", marker="o", ms=5., mew=0., alpha=0.7, mec="none")

		for icl, idx in enumerate(ii):
			pltkwarg["color"] = colorArr[icl]
			ax.plot(xArr[idx, :], yArr[idx, :], **pltkwarg)

		for icl, idx in enumerate(ii):
			ax.plot(xArr[idx, -1], yArr[idx, -1], "k+", ms=6.)

		ax.set_xscale("log")
		ax.set_yscale("log")
		#ax.set_xlim([1.e-5, 1.e-1]); ax.set_ylim([8.e3, 1.2e5])
		ax.set_xlim(N.min(denArr[ii, :]), N.max(denArr[ii, :]))
		ax.set_ylim(N.min(tempArr[ii, :]), N.max(tempArr[ii, :]))
		ax.set_xlabel(r"$n_H$"); ax.set_ylabel(r"$T$")
		figname = "n_H-T_%s_ov%d_vr%d_%sLTmG_eqN%s.%s" % (fignamestr[1], int(simI["over_density"]), simI["virial_radius"], fignamestr[0], int(bin_by_mass), figext)
		plt.savefig(figname)
开发者ID:ynoh,项目名称:highz_dwarfs,代码行数:77,代码来源:plot_mJVSmG.py


注:本文中的matplotlib.backends.backend_pdf.PdfPages.clsoe方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。