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


Python Axes3D.plot_trisurf方法代码示例

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


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

示例1: read_and_overview

# 需要导入模块: from mpl_toolkits.mplot3d import Axes3D [as 别名]
# 或者: from mpl_toolkits.mplot3d.Axes3D import plot_trisurf [as 别名]
import glob

def read_and_overview(filename):
    """Read NetCDF using read_generic_netcdf and print upper level dictionary keys
    """
    test = read_generic_netcdf(filename)
    print("\nPrint keys for file %s" % os.path.basename(filename))
    for key in test.keys():
        print("\t%s" % key)

pfad = ('/automount/ags/velibor/gpmdata/nicht3dComposit/*.nc')

pfad_3d = sorted(glob.glob(pfad))[1]

comp3d = get_wradlib_data_file(pfad_3d)
read_and_overview(comp3d)

from netCDF4 import Dataset
import numpy as np

comp3d = Dataset(pfad_3d, mode='r')



import matplotlib.pyplot as plt
from mpl_toolkits.mplot3d import Axes3D
fig = plt.figure()
ax = fig.add_subplot(111, projection='3d')

Axes3D.plot_trisurf(x,y,z)
开发者ID:vecoveco,项目名称:gpm,代码行数:32,代码来源:pcc_3d.py

示例2: open

# 需要导入模块: from mpl_toolkits.mplot3d import Axes3D [as 别名]
# 或者: from mpl_toolkits.mplot3d.Axes3D import plot_trisurf [as 别名]
#   cPickle.dump([difficulties, generosities, ave_switches], handle)



#read
with open(filename, 'rb') as handle:
   data = cPickle.load(handle)


difficulties=data[0]
generosities=data[1]
ave_switches=data[2]
fig = plt.figure()
ax = Axes3D(fig)
Axes3D.scatter(ax, difficulties, generosities, ave_switches, cmap=cm.jet)
Axes3D.plot_trisurf(ax, difficulties, generosities, ave_switches, cmap=cm.jet)
plt.show()



print ave_switches


 # griddata and contour.     
xi = np.linspace(min(difficulties),max(difficulties),15)
yi = np.linspace(min(generosities),max(generosities),15)
xi = np.linspace(0,1,15)
yi = np.linspace(0,1,15)

print len(difficulties), len(generosities), len(ave_switches)
开发者ID:fiiiu,项目名称:BanditLand,代码行数:32,代码来源:landscapeGrapher.py

示例3: block_analysis

# 需要导入模块: from mpl_toolkits.mplot3d import Axes3D [as 别名]
# 或者: from mpl_toolkits.mplot3d.Axes3D import plot_trisurf [as 别名]
def block_analysis(model=False):
    
    # BLOCK BY BLOCK
    pre_metacog_switches={0:[], 1:[], 2:[]}
    post_metacog_switches={0:[], 1:[], 2:[]}
    difficulties={0:[], 1:[], 2:[]}
    generosities={0:[], 1:[], 2:[]}
    pre_met_swi_rews={0:[], 1:[], 2:[]}
    post_met_swi_rews={0:[], 1:[], 2:[]}
    
    for condition in set(data.conditions):
        for payrate in set(data.payrates):
            pre_metacog_switches[condition].append(gameAnalyzer.metacog_switches(data.bandit_data[condition][payrate], n_trials=subject_trials, post_metacog=False))
            post_metacog_switches[condition].append(gameAnalyzer.metacog_switches(data.bandit_data[condition][payrate], n_trials=subject_trials, post_metacog=True))
            difficulties[condition].append(1-abs(payrate[1]-payrate[0]))
            generosities[condition].append((payrate[1]+payrate[0])/2)
            pre_met_swi_rews[condition].append(gameAnalyzer.metacog_rewards(data.bandit_data[condition][payrate], n_trials=subject_trials, post_metacog=False))
            post_met_swi_rews[condition].append(gameAnalyzer.metacog_rewards(data.bandit_data[condition][payrate], n_trials=subject_trials, post_metacog=True))

    print pre_metacog_switches
    print post_metacog_switches

    print np.mean(pre_metacog_switches[0])
    print np.mean(pre_metacog_switches[1])
    print np.mean(pre_metacog_switches[2])

    print np.mean(post_metacog_switches[0])
    print np.mean(post_metacog_switches[1])
    print np.mean(post_metacog_switches[2])

    s0=sum(post_metacog_switches[0])
    s1=sum(post_metacog_switches[1])
    print s0, s1


    print pre_met_swi_rews
    print post_met_swi_rews

    print np.mean(post_met_swi_rews[0]), np.mean(post_met_swi_rews[1])

    normdif0=np.array(post_metacog_switches[0])-np.array(post_met_swi_rews[0])
    normdif1=np.array(post_metacog_switches[1])-np.array(post_met_swi_rews[1])

    print normdif0
    print normdif1
    print np.mean(normdif0), np.mean(normdif1)


    collapsing=np.array(post_metacog_switches[0])-np.array(post_metacog_switches[1])
    normcollapsing=normdif0-normdif1

    # p=0.057
    print 'pvalue from ttest: {0}'.format(stats.ttest_rel(post_metacog_switches[0],post_metacog_switches[1])[1])
    print 'same for rewards (pvalue from ttest): {0}'.format(stats.ttest_rel(post_met_swi_rews[0], post_met_swi_rews[1])[1])
    print '...and subtracted: {0}'.format(stats.ttest_rel(normdif0, normdif1)[1])


    fig = plt.figure()
    ax = Axes3D(fig)
    Axes3D.scatter(ax, difficulties[0], generosities[0], collapsing, cmap=cm.jet)
    Axes3D.plot_trisurf(ax, difficulties[0], generosities[0], collapsing, cmap=cm.jet)
    plt.show()

    # griddata and contour.     
    xi = np.linspace(min(difficulties[0]),max(difficulties[0]),15)
    yi = np.linspace(min(generosities[0]),max(generosities[0]),15)
    xi = np.linspace(0,1,15)
    yi = np.linspace(0,1,15)

    print len(difficulties[0]), len(generosities[0]), len(collapsing)

    zi = griddata(difficulties[0],generosities[0],collapsing,xi,yi,interp='nn')#linear')

    #plt.contour(xi,yi,zi,15,linewidths=0.5,colors='k')
    plt.contourf(xi,yi,zi,cmap=cm.jet)#,
                 #norm=plt.normalize(vmax=abs(zi).max(), vmin=-abs(zi).max()))

    plt.scatter(difficulties[0], generosities[0], marker='s', c=collapsing, s=200, cmap=cm.jet)
    plt.colorbar() # draw colorba
    plt.xlim([0,1])
    plt.ylim([0,1])
    plt.show()

    # plt.scatter(difficulties[0], generosities[0], marker='s', c=collapsing, s=200, cmap=cm.coolwarm)
    # plt.colorbar()
    # plt.xlim([0,1])
    # plt.ylim([0,1])
    # plt.show()




    if model:

        #MCMC inference for rate difference
        modeldata=np.array([post_metacog_switches[0],post_metacog_switches[1]])
        #modeldata=np.array([post_met_swi_rews[0],post_met_swi_rews[1]]) #this is dubious, but good, nonsignificant
        #modeldata=np.array([normdif0,normdif1]) #this does not work, negative values.. should adapt model for negative reward triggering switch.

        model=pymc.MCMC(rateDifferenceModel.make_model(modeldata, subject_trials))
#.........这里部分代码省略.........
开发者ID:fiiiu,项目名称:BanditLand,代码行数:103,代码来源:banditAnalysis.py


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