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


Python Data.subplot方法代码示例

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


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

示例1: Data

# 需要导入模块: from Stoner import Data [as 别名]
# 或者: from Stoner.Data import subplot [as 别名]
"""Re-binning data example."""
from Stoner import Data
from Stoner.plot.utils import errorfill

d = Data("Noisy_Data.txt", setas="xy")

d.template.fig_height = 6
d.template.fig_width = 8
d.figure(figsize=(6, 8))
d.subplot(411)

e = d.bin(bins=0.05, mode="lin")
f = d.bin(bins=0.25, mode="lin")
g = d.bin(bins=0.05, mode="log")
h = d.bin(bins=50, mode="log")

for i, (binned, label) in enumerate(
    zip([e, f, g, h], ["0.05 Linear", "0.25 Linear", "0.05 Log", "50 log"])
):
    binned.subplot(411 + i)
    d.plot()
    binned.fig = d.fig
    binned.plot(plotter=errorfill, label=label)

    d.xlim = (1, 6)
    d.ylim(-0.1, 0.4)
    d.title = "Bin demo" if i == 0 else ""
d.tight_layout()
开发者ID:gb119,项目名称:Stoner-PythonCode,代码行数:30,代码来源:bins.py

示例2: Data

# 需要导入模块: from Stoner import Data [as 别名]
# 或者: from Stoner.Data import subplot [as 别名]
d = Data(filename, setas="xyy", template=DefaultPlotStyle)
d.normalise(2, scale=(0.0, 10.0))  # Just to keep the plot sane!

# Change the color and line style cycles
d.template["axes.prop_cycle"] = cycler(color=["Blue", "Purple"]) + cycler(
    linestyle=["-", "--"]
)

# Can also access as an attribute
d.template.template_lines__linewidth = 2.0

# Set the default figure size
d.template["figure.figsize"] = (6, 8)
d.template["figure.autolayout"] = True
# Make figure (before using subplot method) and select first subplot
d.figure()
d.subplot(211)
# Pkot with our customised defaults
d.plot()
d.grid(True, color="green", linestyle="-.")
d.title = "Customised Plot settings"
# Reset the template to defaults and switch to next subplot
d.template.clear()
d.subplot(212)
# Plot with defaults
d.plot()
d.title = "Style Default settings"
# Fixup layout
d.figwidth = 7  # Magic pass through attribute access
开发者ID:gb119,项目名称:Stoner-PythonCode,代码行数:31,代码来源:customising.py

示例3: enumerate

# 需要导入模块: from Stoner import Data [as 别名]
# 或者: from Stoner.Data import subplot [as 别名]
    for i,r_col in enumerate(r_cols):
        data.setas(x=t_col,y=r_col)
        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."])




开发者ID:gb119,项目名称:Stoner-PythonCode,代码行数:28,代码来源:Tc_Fit.py

示例4: gmean

# 需要导入模块: from Stoner import Data [as 别名]
# 或者: from Stoner.Data import subplot [as 别名]
        result.data[:, c] = (resfldr[1][:, c] + resfldr[0][:, c]) / 2.0
    for c in [1, 3, 5, 7]:
        result.data[:, c] = gmean((resfldr[0][:, c], resfldr[1][:, c]), axis=0)

    # Doing the Kittel fit with an orthogonal distance regression as we have x errors not y errors
    p0 = [2, 200e3, 10e3]  # Some sensible guesses
    result.lmfit(
        Inverse_Kittel, p0=p0, result=True, header="Kittel Fit", output="report"
    )
    result.setas[-1] = "y"

    result.template.yformatter = TexEngFormatter
    result.template.xformatter = TexEngFormatter
    result.labels = None
    result.figure(figsize=(6, 8))
    result.subplot(211)
    result.plot(fmt=["r.", "b-"])
    result.annotate_fit(Inverse_Kittel, x=7e9, y=1e5, fontdict={"size": 8})
    result.ylabel = "$H_{res} \\mathrm{(Am^{-1})}$"
    result.title = "Inverse Kittel Fit"

    # Get alpha
    result.subplot(212)
    result.setas(y="Delta_H", e="Delta_H.stderr", x="Freq")
    result.y /= mu_0
    result.e /= mu_0
    result.lmfit(Linear, result=True, header="Width", output="report")
    result.setas[-1] = "y"
    result.plot(fmt=["r.", "b-"])
    result.annotate_fit(Linear, x=5.5e9, y=2.8e3, fontdict={"size": 8})
开发者ID:gb119,项目名称:Stoner-PythonCode,代码行数:32,代码来源:plot-folder-test.py


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