當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。