本文整理汇总了Python中Stoner.Data.tight_layout方法的典型用法代码示例。如果您正苦于以下问题:Python Data.tight_layout方法的具体用法?Python Data.tight_layout怎么用?Python Data.tight_layout使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Stoner.Data
的用法示例。
在下文中一共展示了Data.tight_layout方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: Data
# 需要导入模块: from Stoner import Data [as 别名]
# 或者: from Stoner.Data import tight_layout [as 别名]
"""Plot data using mutiple sub-plots."""
from Stoner import Data
p = Data("sample.txt", setas="xyy")
# Quick plot
p.plot(multiple="panels")
# Helps to fix layout !
p.tight_layout()
示例2: zip
# 需要导入模块: from Stoner import Data [as 别名]
# 或者: from Stoner.Data import tight_layout [as 别名]
d.curve_fit(SF.bdr, p0=[2.5, 3.2, 0.3, 15.0, 1.0], result=True, header="curve_fit")
d.setas = "xyey"
d.plot(fmt=["r.", "b-"])
d.annotate_fit(
SF.bdr, x=0.6, y=0.05, prefix="bdr", fontdict={"size": "x-small", "color": "blue"}
)
# lmfit
d.setas = "xy"
fit = SF.BDR(missing="drop")
p0 = fit.guess(I, x=V)
for p, v, mi, mx in zip(
["A", "phi", "dphi", "d", "mass"],
[2.500, 3.2, 0.3, 15.0, 1.0],
[0.100, 1.0, 0.05, 5.0, 0.5],
[10, 10.0, 2.0, 30.0, 5.0],
):
p0[p].value = v
p0[p].bounds = [mi, mx]
d.lmfit(fit, p0=p0, result=True, header="lmfit")
d.setas = "x...y"
d.plot(fmt="g-")
d.annotate_fit(
fit, x=0.2, y=0.05, prefix="BDR", fontdict={"size": "x-small", "color": "green"}
)
d.ylabel = "Current"
d.title = "BDR Model test"
d.tight_layout()
示例3:
# 需要导入模块: from Stoner import Data [as 别名]
# 或者: from Stoner.Data import tight_layout [as 别名]
data.del_rows(isnan(data.y))
#Normalise data on y axis between +/- 1
data.normalise(base=(-1.,1.), replace=True)
#Swap x and y axes around so that R is x and T is y
data=~data
#Curve fit a straight line, using only the central 90% of the resistance transition
data.curve_fit(linear,bounds=lambda x,r:-threshold<x<threshold,result=True,p0=[7.0,0.0]) #result=True to record fit into metadata
#Plot the results
data.setas[-1]="y"
data.subplot(1,len(r_cols),i+1)
data.plot(fmt=["k.","r-"])
data.annotate_fit(linear,x=-1.,y=7.3c,fontsize="small")
data.title="Ramp {}".format(data[iterator][0])
row.extend([data["linear:intercept"],data["linear:intercept err"]])
data.tight_layout()
result+=np.array(row)
result.column_headers=["Ramp","Sample 4 R","dR","Sample 7 R","dR"]
result.setas="xyeye"
result.plot(fmt=["k.","r."])