def SED_plotting_settings(x, ydata):
"""
This function produces the setting for the figures for SED plotting.
**Input:
- all nus, and data (to make the plot limits depending on the data)
"""
fig = plt.figure()
ax1 = fig.add_subplot(111)
ax2 = ax1.twiny()
#-- Latex -------------------------------------------------
rc('text', usetex=True)
rc('font', family='serif')
rc('axes', linewidth=1.5)
#-------------------------------------------------------------
# ax1.set_title(r"\textbf{SED of Type 2}" + r"\textbf{ AGN }"+ "Source Nr. "+ source + "\n . \n . \n ." , fontsize=17, color='k')
ax1.set_xlabel(r'rest-frame $\mathbf{log \ \nu} [\mathtt{Hz}] $', fontsize=13)
ax2.set_xlabel(r'$\mathbf{\lambda} [\mathtt{\mu m}] $', fontsize=13)
ax1.set_ylabel(r'$\mathbf{\nu L(\nu) [\mathtt{erg \ } \mathtt{ s}^{-1}]}$',fontsize=13)
ax1.tick_params(axis='both',reset=False,which='major',length=8,width=1.5)
ax1.tick_params(axis='both',reset=False,which='minor',length=4,width=1.5)
ax1.set_autoscalex_on(True)
ax1.set_autoscaley_on(True)
ax1.set_xscale('linear')
ax1.set_yscale('log')
mediandata = np.median(ydata)
ax1.set_ylim(mediandata /50.,mediandata * 50.)
ax2.set_xscale('log')
ax2.set_yscale('log')
ax2.set_ylim( mediandata /50., mediandata * 50.)
ax2.get_xaxis().set_major_formatter(ticker.ScalarFormatter())
ax2.tick_params(axis='both',reset=False,which='major',length=8,width=1.5)
ax2.tick_params(axis='both',reset=False,which='minor',length=4,width=1.5)
x2 = (2.98e14/ x)[::-1] # Wavelenght axis
ax2.plot(x2, np.ones(len(x2)), alpha=0)
ax2.invert_xaxis()
ax2.set_xticks([100., 10.,1., 0.1])
return fig, ax1, ax2
评论列表
文章目录