本文整理汇总了Python中biggles.FramedPlot.xlabel方法的典型用法代码示例。如果您正苦于以下问题:Python FramedPlot.xlabel方法的具体用法?Python FramedPlot.xlabel怎么用?Python FramedPlot.xlabel使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类biggles.FramedPlot
的用法示例。
在下文中一共展示了FramedPlot.xlabel方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: doplot
# 需要导入模块: from biggles import FramedPlot [as 别名]
# 或者: from biggles.FramedPlot import xlabel [as 别名]
def doplot(self):
tab = Table(2, 1)
tab.title = self.title
xfit, yfit, gprior = self.get_prior_vals()
nrand = 100000
binsize = self.binsize
h = self.h
h1 = self.h1
h2 = self.h2
g1rand, g2rand = gprior.sample2d(nrand)
grand = gprior.sample1d(nrand)
hrand = histogram(grand, binsize=binsize, min=0.0, max=1.0, more=True)
h1rand = histogram(g1rand, binsize=binsize, min=-1.0, max=1.0, more=True)
fbinsize = xfit[1] - xfit[0]
hrand["hist"] = hrand["hist"] * float(yfit.sum()) / hrand["hist"].sum() * fbinsize / binsize
h1rand["hist"] = h1rand["hist"] * float(h1["hist"].sum()) / h1rand["hist"].sum()
pltboth = FramedPlot()
pltboth.xlabel = r"$g$"
hplt1 = Histogram(h1["hist"], x0=h1["low"][0], binsize=binsize, color="red")
hplt2 = Histogram(h2["hist"], x0=h2["low"][0], binsize=binsize, color="blue")
hpltrand = Histogram(hrand["hist"], x0=hrand["low"][0], binsize=binsize, color="magenta")
hplt1rand = Histogram(h1rand["hist"], x0=h1rand["low"][0], binsize=binsize, color="magenta")
hplt1.label = r"$g_1$"
hplt2.label = r"$g_2$"
hplt1rand.label = "rand"
hpltrand.label = "rand"
keyboth = PlotKey(0.9, 0.9, [hplt1, hplt2, hplt1rand], halign="right")
pltboth.add(hplt1, hplt2, hplt1rand, keyboth)
tab[0, 0] = pltboth
plt = FramedPlot()
plt.xlabel = r"$|g|$"
hplt = Histogram(h["hist"], x0=h["low"][0], binsize=binsize)
hplt.label = "|g|"
line = Curve(xfit, yfit, color="blue")
line.label = "model"
key = PlotKey(0.9, 0.9, [hplt, line, hpltrand], halign="right")
plt.add(line, hplt, hpltrand, key)
tab[1, 0] = plt
if self.show:
tab.show()
return tab
示例2: plot
# 需要导入模块: from biggles import FramedPlot [as 别名]
# 或者: from biggles.FramedPlot import xlabel [as 别名]
def plot(self, yrange=None):
from biggles import FramedPlot, Points, Curve, PlotKey, Table,PlotLabel
res=self.res
etrue = res['etrue']
e1true = res['e1true']
e2true = res['e2true']
facvals = res['facvals']
sigma = res['sigma']
e1=res['e1']
e2=res['e2']
e=res['e']
T=res['T']
Ttrue=res['Ttrue']*facvals**2
e_pdiff = e/etrue-1
T_pdiff = T/Ttrue-1
compc= Curve(sigma, sigma*0)
ce = Curve(sigma, e_pdiff, color='red')
pe = Points(sigma, e_pdiff, type='filled circle')
e_plt = FramedPlot()
e_plt.add(ce,pe,compc)
e_plt.xlabel = r'$\sigma$'
e_plt.ylabel = r'$e/e_{true}-1$'
cT = Curve(sigma, T_pdiff, color='red')
pT = Points(sigma, T_pdiff, type='filled circle')
T_plt = FramedPlot()
T_plt.add(cT,pT,compc)
T_plt.xlabel = r'$\sigma$'
T_plt.ylabel = r'$T/T_{true}-1$'
lab=PlotLabel(0.9,0.9,self.model,halign='right')
T_plt.add(lab)
if yrange is not None:
e_plt.yrange=yrange
T_plt.yrange=yrange
tab=Table(2,1)
tab[0,0] = T_plt
tab[1,0] = e_plt
tab.show()
示例3: plotrand
# 需要导入模块: from biggles import FramedPlot [as 别名]
# 或者: from biggles.FramedPlot import xlabel [as 别名]
def plotrand(x, y, frac=0.1, plt=None, **keys):
import biggles
from biggles import FramedPlot, Points
if plt is None:
plt = FramedPlot()
x=numpy.array(x,ndmin=1,copy=False)
y=numpy.array(y,ndmin=1,copy=False)
if x.size != y.size:
raise ValueError("x,y must be same size")
nrand = int(x.size*frac)
ind = numpy_util.random_subset(x.size, nrand)
if 'type' not in keys:
keys['type'] = 'dot'
c = Points(x[ind], y[ind], **keys)
plt.add(c)
if 'xlabel' in keys:
plt.xlabel = keys['xlabel']
if 'ylabel' in keys:
plt.ylabel = keys['ylabel']
show = keys.get('show',True)
if show:
plt.show()
return plt
示例4: plot_radec
# 需要导入模块: from biggles import FramedPlot [as 别名]
# 或者: from biggles.FramedPlot import xlabel [as 别名]
def plot_radec(self, type):
"""
ra/dec plot of all points and the matched points
"""
import biggles
import converter
from biggles import FramedPlot,Points
print()
dir=self.plotdir()
if not os.path.exists(dir):
os.makedirs(dir)
psfile = self.plotfile(type)
orig = self.read_original(type)
mat = self.read_matched(type)
plt=FramedPlot()
symsize = 2
if type == 'sdss' or type == 'other':
symsize = 0.25
plt.add( Points(orig['ra'],orig['dec'],type='dot', size=symsize) )
plt.add( Points(mat['ra'],mat['dec'],type='dot',
color='red', size=symsize) )
plt.xlabel = 'RA'
plt.ylabel = 'DEC'
print("Writing eps file:", psfile)
plt.write_eps(psfile)
converter.convert(psfile, dpi=120, verbose=True)
示例5: plot_T
# 需要导入模块: from biggles import FramedPlot [as 别名]
# 或者: from biggles.FramedPlot import xlabel [as 别名]
def plot_T(self, k, T, Tc=None, Tb=None):
from biggles import FramedPlot, Curve, PlotKey
plt=FramedPlot()
c=Curve(k, T**2)
c.label = '$T^2$'
plt.add(c)
plist = [c]
if Tc is not None:
cc=Curve(k,Tc**2,color='blue')
cc.label = '$Tc^2$'
plt.add(cc)
plist.append(cc)
if Tb is not None:
tmp = where(Tb < 1.e-5, 1.e-5, Tb)
cb=Curve(k,tmp**2,color='red')
cb.label = '$Tb^2$'
plt.add(cb)
plist.append(cb)
plt.xlog=True
plt.ylog=True
plt.ylabel = '$T^2'
plt.xlabel = 'k'
plt.yrange = [1.e-8,1.0]
plt.aspect_ratio=1
if Tc is not None or Tb is not None:
key=PlotKey(0.1,0.9,plist)
plt.add(key)
plt.show()
示例6: plot_masserr
# 需要导入模块: from biggles import FramedPlot [as 别名]
# 或者: from biggles.FramedPlot import xlabel [as 别名]
def plot_masserr(self, filename):
import pcolors
data=eu.io.read(filename)
nr200 = data.size
nb = data['B'][0].size
plt = FramedPlot()
colors = pcolors.rainbow(nr200, 'hex')
clist = []
for ri in xrange(nr200):
r200 = data['r200'][ri]
m200 = data['m200'][ri]
p = Points(data['B'][ri], (m200-data['m200meas'][ri])/m200,
type='filled circle', color=colors[ri])
crv = Curve(data['B'][ri], (m200-data['m200meas'][ri])/m200,
color=colors[ri])
crv.label = 'r200: %0.2f' % r200
clist.append(crv)
plt.add(p,crv)
key = PlotKey(0.1,0.4,clist)
plt.add(key)
plt.xlabel=r'$\Omega_m \sigma_8^2 D(z)^2 b(M,z)$'
plt.ylabel = r'$(M_{200}^{true}-M)/M_{200}^{true}$'
epsfile = filename.replace('.rec','.eps')
print 'writing eps:',epsfile
plt.write_eps(eu.ostools.expand_path(epsfile))
示例7: test_fit_nfw_dsig
# 需要导入模块: from biggles import FramedPlot [as 别名]
# 或者: from biggles.FramedPlot import xlabel [as 别名]
def test_fit_nfw_dsig(rmin=0.01):
from biggles import FramedPlot,Points,SymmetricErrorBarsY,Curve
omega_m=0.25
z=0.25
n = lensing.nfw.NFW(omega_m, z)
r200 = 1.0
c = 5.0
rmax = 5.0
log_rmin = log10(rmin)
log_rmax = log10(rmax)
npts = 25
logr = numpy.linspace(log_rmin,log_rmax,npts)
r = 10.0**logr
ds = n.dsig(r, r200, c)
# 10% errors
dserr = 0.1*ds
ds += dserr*numpy.random.standard_normal(ds.size)
guess = numpy.array([r200,c],dtype='f8')
# add 10% error to the guess
guess += 0.1*guess*numpy.random.standard_normal(guess.size)
res = fit_nfw_dsig(omega_m, z, r, ds, dserr, guess)
r200_fit = res['r200']
r200_err = res['r200_err']
c_fit = res['c']
c_err = res['c_err']
print 'Truth:'
print ' r200: %f' % r200
print ' c: %f' % c
print 'r200_fit: %f +/- %f' % (r200_fit,r200_err)
print ' c_fit: %f +/- %f' % (c_fit,c_err)
print 'Cov:'
print res['cov']
logr = numpy.linspace(log_rmin,log_rmax,1000)
rlots = 10.0**logr
yfit = n.dsig(rlots,r200_fit,c_fit)
plt=FramedPlot()
plt.add(Points(r,ds,type='filled circle'))
plt.add(SymmetricErrorBarsY(r,ds,dserr))
plt.add(Curve(rlots,yfit,color='blue'))
plt.xlabel = r'$r$ [$h^{-1}$ Mpc]'
plt.ylabel = r'$\Delta\Sigma ~ [M_{sun} pc^{-2}]$'
plt.xrange = [0.5*rmin, 1.5*rmax]
plt.yrange = [0.5*(ds-dserr).min(), 1.5*(ds+dserr).max()]
plt.xlog=True
plt.ylog=True
plt.show()
示例8: plot_nfwfits_byrun
# 需要导入模块: from biggles import FramedPlot [as 别名]
# 或者: from biggles.FramedPlot import xlabel [as 别名]
def plot_nfwfits_byrun(run, name, prompt=False):
conf = lensing.files.read_config(run)
d = lensing.sample_read(type='fit', sample=run, name=name)
omega_m = conf['omega_m']
rvals = numpy.linspace(d['r'].min(), d['r'].max(),1000)
for i in xrange(d.size):
plt = FramedPlot()
lensing.plotting.add_to_log_plot(plt,
d['r'][i],
d['dsig'][i],
d['dsigerr'][i])
z = d['z_mean'][i]
n = lensing.nfw.NFW(omega_m, z)
yfit = n.dsig(rvals, d['r200_fit'][i],d['c_fit'][i])
plt.add(Curve(rvals,yfit,color='blue'))
plt.xlog=True
plt.ylog=True
plt.xlabel = r'$r$ [$h^{-1}$ Mpc]'
plt.ylabel = r'$\Delta\Sigma ~ [M_{sun} pc^{-2}]$'
if prompt:
plt.show()
raw_input('hit a key: ')
else:
epsfile='/home/esheldon/tmp/plots/desmocks-nfwfit-%02i.eps' % i
print 'Writing epsfile:',epsfile
plt.write_eps(epsfile)
示例9: test_xi_converge_nplk
# 需要导入模块: from biggles import FramedPlot [as 别名]
# 或者: from biggles.FramedPlot import xlabel [as 别名]
def test_xi_converge_nplk(epsfile=None):
"""
Test how xi converges with the number of k points per log10(k)
Note we should test other convergence factors too!
"""
tab=Table(2,1)
pltbig = FramedPlot()
pltzoom = FramedPlot()
pltbig.xlabel='r'
pltbig.ylabel='xi(r)'
pltbig.xlog=True
pltbig.ylog=True
pltzoom.xlabel='r'
pltzoom.ylabel='xi(r)'
l=Linear()
r=10.0**linspace(0.0,2.3,1000)
nplk_vals = [20,60,100,140,160]
color_vals = ['blue','skyblue','green','orange','magenta','red']
plist=[]
lw=2.4
for nplk,color in zip(nplk_vals,color_vals):
print 'nplk:',nplk
xi = l.xi(r, nplk=nplk)
limxi = where(xi < 1.e-5, 1.e-5, xi)
climxi = Curve(r,limxi,color=color,linewidth=lw)
climxi.label = 'nplk: %i' % nplk
pltbig.add(climxi)
plist.append(climxi)
w=where1(r > 50.0)
cxi = Curve(r[w], xi[w], color=color, linewidth=lw)
pltzoom.add(cxi)
key = PlotKey(0.7,0.8, plist)
pltzoom.add(key)
tab[0,0] = pltbig
tab[1,0] = pltzoom
if epsfile is not None:
tab.write_eps(epsfile)
else:
tab.show()
示例10: plot_pk
# 需要导入模块: from biggles import FramedPlot [as 别名]
# 或者: from biggles.FramedPlot import xlabel [as 别名]
def plot_pk(self,k,pk):
from biggles import FramedPlot, Curve
plt=FramedPlot()
plt.add(Curve(k,pk))
plt.xlog=True
plt.ylog=True
plt.xlabel = r'$k [h/Mpc]$'
plt.ylabel = r'$P_{lin}(k)$'
plt.aspect_ratio = 1
plt.show()
示例11: make_plot
# 需要导入模块: from biggles import FramedPlot [as 别名]
# 或者: from biggles.FramedPlot import xlabel [as 别名]
def make_plot(self):
bindata=self.bindata
bin_field=self.bin_field
plt=FramedPlot()
plt.uniform_limits=1
plt.xlog=True
#plt.xrange=[0.5*bindata[bin_field].min(), 1.5*bindata[bin_field].max()]
plt.xrange=self.s2n_range
plt.xlabel=bin_field
plt.ylabel = r'$\gamma$'
if self.yrange is not None:
plt.yrange=self.yrange
xdata=bindata[bin_field]
xerr=bindata[bin_field+'_err']
if self.shnum in sh1exp:
g1exp=zeros(xdata.size)+sh1exp[self.shnum]
g2exp=zeros(xdata.size)+sh2exp[self.shnum]
g1exp_plt=Curve(xdata, g1exp)
g2exp_plt=Curve(xdata, g2exp)
plt.add(g1exp_plt)
plt.add(g2exp_plt)
xerrpts1 = SymmetricErrorBarsX(xdata, bindata['g1'], xerr)
xerrpts2 = SymmetricErrorBarsX(xdata, bindata['g2'], xerr)
type='filled circle'
g1color='blue'
g2color='red'
g1pts = Points(xdata, bindata['g1'], type=type, color=g1color)
g1errpts = SymmetricErrorBarsY(xdata, bindata['g1'], bindata['g1_err'], color=g1color)
g2pts = Points(xdata, bindata['g2'], type=type, color=g2color)
g2errpts = SymmetricErrorBarsY(xdata, bindata['g2'], bindata['g2_err'], color=g2color)
g1pts.label=r'$\gamma_1$'
g2pts.label=r'$\gamma_2$'
key=biggles.PlotKey(0.9,0.5,[g1pts,g2pts],halign='right')
plt.add( xerrpts1, g1pts, g1errpts )
plt.add( xerrpts2, g2pts, g2errpts )
plt.add(key)
labels=self.get_labels()
plt.add(*labels)
plt.aspect_ratio=1
self.plt=plt
示例12: plot_sub_pixel
# 需要导入模块: from biggles import FramedPlot [as 别名]
# 或者: from biggles.FramedPlot import xlabel [as 别名]
def plot_sub_pixel(ellip,theta, show=False):
import biggles
from biggles import PlotLabel,FramedPlot,Table,Curve,PlotKey,Points
from pcolors import rainbow
f=subpixel_file(ellip,theta,'fits')
data = eu.io.read(f)
colors = rainbow(data.size,'hex')
pltSigma = FramedPlot()
pltSigma.ylog=1
pltSigma.xlog=1
curves=[]
for j in xrange(data.size):
sigest2 = (data['Irr'][j,:] + data['Icc'][j,:])/2
pdiff = sigest2/data['sigma'][j]**2 -1
nsub=numpy.array(data['nsub'][j,:])
#pc = biggles.Curve(nsub, pdiff, color=colors[j])
pp = Points(data['nsub'][j,:], pdiff, type='filled circle',color=colors[j])
pp.label = r'$\sigma: %0.2f$' % data['sigma'][j]
curves.append(pp)
pltSigma.add(pp)
#pltSigma.add(pc)
#pltSigma.yrange=[0.8,1.8]
#pltSigma.add(pp)
c5 = Curve(linspace(1,8, 20), .005+zeros(20))
pltSigma.add(c5)
key=PlotKey(0.95,0.95,curves,halign='right',fontsize=1.7)
key.key_vsep=1
pltSigma.add(key)
pltSigma.xlabel='N_{sub}'
pltSigma.ylabel=r'$\sigma_{est}^2 /\sigma_{True}^2 - 1$'
lab=PlotLabel(0.05,0.07,r'$\epsilon: %0.2f \theta: %0.2f$' % (ellip,theta),halign='left')
pltSigma.add(lab)
pltSigma.yrange = [1.e-5,0.1]
pltSigma.xrange = [0.8,20]
if show:
pltSigma.show()
epsfile=subpixel_file(ellip,theta,'eps')
print("Writing eps file:",epsfile)
pltSigma.write_eps(epsfile)
示例13: plot_dsig_one
# 需要导入模块: from biggles import FramedPlot [as 别名]
# 或者: from biggles.FramedPlot import xlabel [as 别名]
def plot_dsig_one(r, dsig, dsigerr, **kw):
"""
plot delta sigma
useful if adding to an existing plot
parameters
----------
r: array
radius
dsig: array
delta sigma
dsigerr: array
error on delta sigma
"""
from biggles import FramedPlot
nbin=1
_set_biggles_defs(nbin)
visible=kw.get('visible',True)
xlog=kw.get('xlog',True)
ylog=kw.get('ylog',True)
aspect_ratio=kw.get('aspect_ratio',1)
is_ortho=kw.get('is_ortho',False)
plt=kw.get('plt',None)
if plt is None:
plt=FramedPlot()
plt.aspect_ratio=aspect_ratio
plt.xlog=xlog
plt.ylog=ylog
plt.xlabel = LABELS['rproj']
if is_ortho:
plt.ylabel = LABELS['osig']
else:
plt.ylabel = LABELS['dsig']
xrng, yrng = _add_dsig_to_plot(plt, r, dsig, dsigerr, **kw)
plt.xrange=xrng
plt.yrange=yrng
if visible:
plt.show()
return plt
示例14: plot_ellip_vs_input
# 需要导入模块: from biggles import FramedPlot [as 别名]
# 或者: from biggles.FramedPlot import xlabel [as 别名]
def plot_ellip_vs_input(self, show=False):
'''
Plot the measured ellip as a function of the input for sigma_index=0
which is a reasonably large object
'''
import biggles
from biggles import PlotLabel,FramedPlot,Table,Curve,PlotKey,Points
from pcolors import rainbow
import pprint
data = self.read()
w=where1(data['sigma_index'] == 10)
data = data[w]
e1_input, e2_input, Tinput = util.mom2ellip(data['Irr_input'],
data['Irc_input'],
data['Icc_input'])
e1_meas, e2_meas, Tinput = util.mom2ellip(data['Irr_meas'],
data['Irc_meas'],
data['Icc_meas'])
einput = sqrt(e1_input**2 + e2_input**2)
emeas = sqrt(e1_meas**2 + e2_meas**2)
plt=FramedPlot()
p = Points(einput,emeas, type='filled circle')
plt.add(p)
plt.xlabel=r'$\epsilon_{in}$'
plt.ylabel=r'$\epsilon_{meas}$'
sig=sqrt((data['Irr_meas'][0]+data['Icc_meas'][0])/2)
lab1=PlotLabel(0.1,0.9,self.model, halign='left')
lab2=PlotLabel(0.1,0.8,r'$\sigma: %0.2f$' % sig, halign='left')
plt.add(lab1,lab2)
einput.sort()
c = Curve(einput, einput, color='red')
c.label = r'$\epsilon_{input} = \epsilon_{meas}$'
key=PlotKey(0.95,0.07,[c], halign='right')
plt.add(c)
plt.add(key)
if show:
plt.show()
epsfile=self.epsfile('ellip-vs-input')
print("Writing eps file:",epsfile)
plt.write_eps(epsfile)
示例15: plot_boss_geometry
# 需要导入模块: from biggles import FramedPlot [as 别名]
# 或者: from biggles.FramedPlot import xlabel [as 别名]
def plot_boss_geometry(color=None, colorwheel=None, plt=None, width=1, show=True,
region=None):
"""
Plot the boundaries in the boss_survey.par file
"""
import esutil as eu
import biggles
from biggles import FramedPlot, Curve
bg = read_boss_geometry()
if plt is None:
plt = FramedPlot()
plt.xlabel=r'$\lambda$'
plt.ylabel=r'$\eta$'
if color is not None:
colors = [color]*len(bg)
elif colorwheel is not None:
colors = colorwheel
else:
colors = ['red','blue','green','magenta','navyblue','seagreen',
'firebrick','cadetblue','green4']
for i in xrange(len(bg)):
b = bg[i]
color = colors[i % len(colors)]
c = eu.plotting.bbox( b['clambdaMin'], b['clambdaMax'], b['cetaMin'], b['cetaMax'],
color=color, width=width)
plt.add(c)
if region == 'ngc':
plt.yrange = [-40.,50.]
plt.xrange = [-80.,80.]
elif region == 'sgc':
plt.yrange = [105.,165.]
plt.xrange = [-60.,60.]
else:
plt.yrange = [-40.,165.]
plt.xrange = [-80.,80.]
plt.aspect_ratio = (plt.yrange[1]-plt.yrange[0])/(plt.xrange[1]-plt.xrange[0])
if show:
plt.show()
return plt