python类xlabel()的实例源码

7 code.py 文件源码 项目:computational_physics_N2014301020117 作者: yukangnineteen 项目源码 文件源码 阅读 47 收藏 0 点赞 0 评论 0
def show_log(self):
#        pl.subplot(121)
        pl.semilogy(self.time_array, self.delta, 'c')
        pl.xlabel('$time (s)$')
        pl.ylabel('$\\Delta\\theta$ (radians)')
        pl.xlim(0, self.T)
#        pl.ylim(1E-11, 0.01)
        pl.text(42, 1E-7, '$\\Delta\\theta$ versus time $F_D = 1.2$', fontsize = 'x-large')
        pl.title('Chaotic Regime')
        pl.show()

#    def show_log_sub122(self):
#        pl.subplot(122)
#        pl.semilogy(self.time_array, self.delta, 'g')
#        pl.xlabel('$time (s)$')
#        pl.ylabel('$\\Delta\\theta$ (radians)')
#        pl.xlim(0, self.T)
#        pl.ylim(1E-6, 100)
#        pl.text(20, 1E-5, '$\\Delta\\theta$ versus time $F_D = 1.2$', fontsize = 'x-large')
#        pl.title('Chaotic Regime')
#        pl.show()
6 code.py 文件源码 项目:computational_physics_N2014301020117 作者: yukangnineteen 项目源码 文件源码 阅读 31 收藏 0 点赞 0 评论 0
def show_complex(self):
        font = {'family': 'serif',
                'color':  'k',
                'weight': 'normal',
                'size': 16,
        }
        pl.title('The Trajectory of Tageted Baseball\n with air flow in adiabatic model', fontdict = font)
        pl.plot(self.x, self.y, label = '$v_0 = %.5f m/s$'%self.v0 + ', ' + '$\\theta = %.4f \degree$'%self.theta)
        pl.xlabel('x $m$')
        pl.ylabel('y $m$')
        pl.xlim(0, 300)
        pl.ylim(-100, 20)
        pl.grid()
        pl.legend(loc = 'upper right', shadow = True, fontsize = 'small')
        pl.text(15, -90, 'scan to approach the minimum velocity and corresponding launching angle', fontdict = font)
        pl.show()
6 code.py 文件源码 项目:computational_physics_N2014301020117 作者: yukangnineteen 项目源码 文件源码 阅读 27 收藏 0 点赞 0 评论 0
def show_simple(self):
        font = {'family': 'serif',
                'color':  'k',
                'weight': 'normal',
                'size': 16,
        }
        pl.title('The Trajectory of Tageted Baseball\n with air flow in adiabatic model', fontdict = font)
        pl.plot(self.x, self.y, label ='$\\alpha = %.0f \degree$'%self.alpha)
        pl.xlabel('x $m$')
        pl.ylabel('y $m$')
        pl.xlim(0, 400)
        pl.ylim(-100, 200)
        pl.grid()
        pl.legend(loc = 'upper right', shadow = True, fontsize = 'medium')
        pl.text(5, -80, 'trojectories varing with angles of wind', fontdict = font)
        pl.show()
5 code 1.py 文件源码 项目:computational_physics_N2014301020117 作者: yukangnineteen 项目源码 文件源码 阅读 35 收藏 0 点赞 0 评论 0
def show_results(self):
        font = {'family': 'serif',
                'color':  'k',
                'weight': 'normal',
                'size': 14,
        }
        pl.plot(self.x, self.y, 'c', label='firing angle = 45°')
        pl.title('The Trajectory of a Cannon Shell', fontdict = font)
        pl.xlabel('x (k$m$)')
        pl.ylabel('y ($km$)')
        pl.xlim(0, 60)
        pl.ylim(0, 20)
        pl.grid(True)
        pl.legend(loc='upper right', shadow=True, fontsize='large')
        pl.text(41, 16, 'Only with air drag', fontdict = font)
        pl.show()
5 code 4.py 文件源码 项目:computational_physics_N2014301020117 作者: yukangnineteen 项目源码 文件源码 阅读 25 收藏 0 点赞 0 评论 0
def show_results(self):
        font = {'family': 'serif',
                'color':  'k',
                'weight': 'normal',
                'size': 12,
        }
        pl.plot(self.x, self.y, 'c', label='firing angle = 45°')
        pl.title('The Trajectory of a Cannon Shell', fontdict = font)
        pl.xlabel('x (k$m$)')
        pl.ylabel('y ($km$)')
        pl.xlim(0, 60)
        pl.ylim(0, 20)
        pl.grid(True)
        pl.legend(loc='upper right', shadow=True, fontsize='large')
        pl.text(34.5, 16, '      With air drag and the \n dependence of g on altitude', fontdict = font)
        pl.show()
5 code 3.py 文件源码 项目:computational_physics_N2014301020117 作者: yukangnineteen 项目源码 文件源码 阅读 25 收藏 0 点赞 0 评论 0
def show_results(self):
        font = {'family': 'serif',
                'color':  'k',
                'weight': 'normal',
                'size': 12,
        }
        pl.plot(self.x, self.y, 'c', label='firing angle = 45°')
        pl.title('The Trajectory of a Cannon Shell', fontdict = font)
        pl.xlabel('x (k$m$)')
        pl.ylabel('y ($km$)')
        pl.xlim(0, 60)
        pl.ylim(0, 20)
        pl.grid(True)
        pl.legend(loc='upper right', shadow=True, fontsize='large')
        pl.text(34.5, 16, '       With both air drag and \n reduced air density-adiabatic', fontdict = font)
        pl.show()
doscalars.py 文件源码 项目:pysynphot 作者: spacetelescope 项目源码 文件源码 阅读 18 收藏 0 点赞 0 评论 0
def plotdata(obsmode,spectrum,val,odict,sdict,
             instr,fieldname,outdir,outname):
    isetting=P.isinteractive()
    P.ioff()

    P.clf()
    P.plot(obsmode,val,'.')
    P.ylabel('(pysyn-syn)/syn')
    P.xlabel('obsmode')
    P.title("%s: %s"%(instr,fieldname))
    P.savefig(os.path.join(outdir,outname+'_obsmode.ps'))

    P.clf()
    P.plot(spectrum,val,'.')
    P.ylabel('(pysyn-syn)/syn')
    P.xlabel('spectrum')
    P.title("%s: %s"%(instr,fieldname))
    P.savefig(os.path.join(outdir,outname+'_spectrum.ps'))

    matplotlib.interactive(isetting)
experiment.py 文件源码 项目:dueling-network 作者: musyoku 项目源码 文件源码 阅读 35 收藏 0 点赞 0 评论 0
def plot_evaluation_episode_reward():
    pylab.clf()
    sns.set_context("poster")
    pylab.plot(0, 0)
    episodes = [0]
    average_scores = [0]
    median_scores = [0]
    for n in xrange(len(csv_evaluation)):
        params = csv_evaluation[n]
        episodes.append(params[0])
        average_scores.append(params[1])
        median_scores.append(params[2])
    pylab.plot(episodes, average_scores, sns.xkcd_rgb["windows blue"], lw=2)
    pylab.xlabel("episodes")
    pylab.ylabel("average score")
    pylab.savefig("%s/evaluation_episode_average_reward.png" % args.plot_dir)

    pylab.clf()
    pylab.plot(0, 0)
    pylab.plot(episodes, median_scores, sns.xkcd_rgb["windows blue"], lw=2)
    pylab.xlabel("episodes")
    pylab.ylabel("median score")
    pylab.savefig("%s/evaluation_episode_median_reward.png" % args.plot_dir)
plotters.py 文件源码 项目:PyME 作者: vikramsunkara 项目源码 文件源码 阅读 19 收藏 0 点赞 0 评论 0
def plot_2D_contour(states,p,labels,inter=False):
    import pylab as pl

    from pyme.statistics import expectation as EXP
    exp = EXP((states,p)) 
    X = np.unique(states[0,:])
    Y = np.unique(states[1,:])
    X_len = len(X)
    Y_len = len(Y)
    Z = np.zeros((X.max()+1,Y.max()+1))
    for i in range(len(p)):
        Z[states[0,i],states[1,i]] = p[i]

    Z = np.where(Z < 1e-8,0.0,Z)
    pl.clf()
    XX, YY = np.meshgrid(X,Y)   
    pl.contour(range(X.max()+1),range(Y.max()+1),Z.T)
    pl.axhline(y=exp[1])
    pl.axvline(x=exp[0])
    pl.xlabel(labels[0])
    pl.ylabel(labels[1])
    if inter == True:
        pl.draw()
    else:
        pl.show()
diagnostic_plots.py 文件源码 项目:ugali 作者: DarkEnergySurvey 项目源码 文件源码 阅读 27 收藏 0 点赞 0 评论 0
def starPlot(targ_ra, targ_dec, data, iso, g_radius, nbhd):
    """Star bin plot"""

    mag_g = data[mag_g_dred_flag]
    mag_r = data[mag_r_dred_flag]

    filter = star_filter(data)

    iso_filter = (iso.separation(mag_g, mag_r) < 0.1)

    # projection of image
    proj = ugali.utils.projector.Projector(targ_ra, targ_dec)
    x, y = proj.sphereToImage(data[filter & iso_filter]['RA'], data[filter & iso_filter]['DEC'])

    plt.scatter(x, y, edgecolor='none', s=3, c='black')
    plt.xlim(0.2, -0.2)
    plt.ylim(-0.2, 0.2)
    plt.gca().set_aspect('equal')
    plt.xlabel(r'$\Delta \alpha$ (deg)')
    plt.ylabel(r'$\Delta \delta$ (deg)')

    plt.title('Stars')
image_ocr.py 文件源码 项目:keras 作者: NVIDIA 项目源码 文件源码 阅读 38 收藏 0 点赞 0 评论 0
def on_epoch_end(self, epoch, logs={}):
        self.model.save_weights(os.path.join(self.output_dir, 'weights%02d.h5' % (epoch)))
        self.show_edit_distance(256)
        word_batch = next(self.text_img_gen)[0]
        res = decode_batch(self.test_func, word_batch['the_input'][0:self.num_display_words])
        if word_batch['the_input'][0].shape[0] < 256:
            cols = 2
        else:
            cols = 1
        for i in range(self.num_display_words):
            pylab.subplot(self.num_display_words // cols, cols, i + 1)
            if K.image_dim_ordering() == 'th':
                the_input = word_batch['the_input'][i, 0, :, :]
            else:
                the_input = word_batch['the_input'][i, :, :, 0]
            pylab.imshow(the_input.T, cmap='Greys_r')
            pylab.xlabel('Truth = \'%s\'\nDecoded = \'%s\'' % (word_batch['source_str'][i], res[i]))
        fig = pylab.gcf()
        fig.set_size_inches(10, 13)
        pylab.savefig(os.path.join(self.output_dir, 'e%02d.png' % (epoch)))
        pylab.close()
PVAnalysis.py 文件源码 项目:PyPeVoc 作者: goiosunsw 项目源码 文件源码 阅读 26 收藏 0 点赞 0 评论 0
def plot_time_freq(self, colors=True, ax=None):
        import pylab as pl

        if ax is None:
            fig, allax = pl.subplots(1)
            ax = allax

        # make time matrix same shape as others
        t = np.outer(self.t, np.ones(self.npeaks))
        f = self.f
        if colors:
            mag = 20*np.log10(self.mag)
            ax.scatter(t, f, s=6, c=mag, lw=0)
        else:
            mag = 100 + 20*np.log10(self.mag)
            ax.scatter(t, f, s=mag, lw=0)
        pl.xlabel('Time (s)')
        pl.ylabel('Frequency (Hz)')
        # if colors:
        # cs = pl.colorbar(ax=ax)
        # cs.set_label('Magnitude (dB)')
        # pl.show()
        return ax
PVAnalysis.py 文件源码 项目:PyPeVoc 作者: goiosunsw 项目源码 文件源码 阅读 27 收藏 0 点赞 0 评论 0
def plot_time_mag(self):
        import pylab as pl

        pl.figure()
        t = np.outer(self.t, np.ones(self.npeaks))
        # f = np.log2(self.f)
        f = self.f
        mag = 20*np.log10(self.mag)
        pl.scatter(t, mag, s=10, c=f, lw=0,
                   norm=pl.matplotlib.colors.LogNorm())
        pl.xlabel('Time (s)')
        pl.ylabel('Magnitude (dB)')
        cs = pl.colorbar()
        cs.set_label('Frequency (Hz)')
        # pl.show()
        return pl.gca()
PVAnalysis.py 文件源码 项目:PyPeVoc 作者: goiosunsw 项目源码 文件源码 阅读 25 收藏 0 点赞 0 评论 0
def two_plot_time_freq_mag(self, minlen=10):
        part = [pp for pp in self.partial if len(pp.f) > minlen]
        pl.figure()
        ax1 = pl.subplot(211)
        pl.hold(True)
        ax2 = pl.subplot(212, sharex=ax1)
        pl.hold(True)
        for pp in part:
            ax1.plot(pp.start_idx + np.arange(len(pp.f)), np.array(pp.f))
            ax2.plot(pp.start_idx + np.arange(len(pp.f)),
                     20*np.log10(np.array(pp.mag)))
        ax1.hold(False)
        # ax1.xlabel('Time (s)')
        ax1.set_ylabel('Frequency (Hz)')
        ax2.set_xlabel('Time (s)')
        ax2.set_ylabel('Frequency (Hz)')
        # pl.show()
        return pl.gca()
PVAnalysis.py 文件源码 项目:PyPeVoc 作者: goiosunsw 项目源码 文件源码 阅读 25 收藏 0 点赞 0 评论 0
def plot_time_freq_mag(self, minlen=10, cm=pl.cm.rainbow):

        cadd = 30
        cmax = 256
        ccur = 0

        part = [pp for pp in self.partial if len(pp.f) > minlen]
        pl.figure()
        pl.hold(True)
        for pp in part:
            # pl.plot(pp.start_idx + np.arange(len(pp.f)), np.array(pp.f))
            mag = 100 + 20*np.log10(np.array(pp.mag))
            pl.scatter(pp.start_idx + np.arange(len(pp.f)), np.array(pp.f),
                       s=mag, c=cm(ccur), lw=0)
            ccur = np.mod(ccur + cadd, cmax)
        pl.hold(False)
        pl.xlabel('Time (s)')
        pl.ylabel('Frequency (Hz)')
        pl.show()
TargetImage.py 文件源码 项目:hco-experiments 作者: zooniverse 项目源码 文件源码 阅读 25 收藏 0 点赞 0 评论 0
def visualiseNormObject(self):
        shape = (2*self.extent, 2*self.extent)
        pylab.ion()
        pylab.clf()
        #pylab.set_cmap("bone")
        pylab.hot()
        pylab.title("image: %s" % self.fitsFile)
        pylab.imshow(np.reshape(self.signPreserveNorm(), shape, order="F"), interpolation="nearest")
        pylab.plot(np.arange(0,2*self.extent), self.extent*np.ones((2*self.extent,)), "r--")
        pylab.plot(self.extent*np.ones((2*self.extent,)), np.arange(0,2*self.extent), "r--")
        pylab.colorbar()
        pylab.ylim(-1, 2*self.extent)
        pylab.xlim(-1, 2*self.extent)
        pylab.xlabel("Pixels")
        pylab.ylabel("Pixels")
        pylab.show()
TargetImage.py 文件源码 项目:hco-experiments 作者: zooniverse 项目源码 文件源码 阅读 28 收藏 0 点赞 0 评论 0
def visualiseNormObject(self):
        shape = (2*self.extent, 2*self.extent)
        pylab.ion()
        pylab.clf()
        #pylab.set_cmap("bone")
        pylab.hot()
        pylab.title("image: %s" % self.fitsFile)
        pylab.imshow(np.reshape(self.signPreserveNorm(), shape, order="F"), interpolation="nearest")
        pylab.plot(np.arange(0,2*self.extent), self.extent*np.ones((2*self.extent,)), "r--")
        pylab.plot(self.extent*np.ones((2*self.extent,)), np.arange(0,2*self.extent), "r--")
        pylab.colorbar()
        pylab.ylim(-1, 2*self.extent)
        pylab.xlim(-1, 2*self.extent)
        pylab.xlabel("Pixels")
        pylab.ylabel("Pixels")
        pylab.show()
Fourier.py 文件源码 项目:ArduPi-ECG 作者: ferdavid1 项目源码 文件源码 阅读 25 收藏 0 点赞 0 评论 0
def main():
    data = pd.read_table('../Real_Values.txt').get_values()
    x = [float(d) for d in data]
    test = np.array([669, 592, 664, 1005, 699, 401, 646, 472, 598, 681, 1126, 1260, 562, 491, 714, 530, 521, 687, 776, 802, 499, 536, 871, 801, 965, 768, 381, 497, 458, 699, 549, 427, 358, 219, 635, 756, 775, 969, 598, 630, 649, 722, 835, 812, 724, 966, 778, 584, 697, 737, 777, 1059, 1218, 848, 713, 884, 879, 1056, 1273, 1848, 780, 1206, 1404, 1444, 1412, 1493, 1576, 1178, 836, 1087, 1101, 1082, 775, 698, 620, 651, 731, 906, 958, 1039, 1105, 620, 576, 707, 888, 1052, 1072, 1357, 768, 986, 816, 889, 973, 983, 1351, 1266, 1053, 1879, 2085, 2419, 1880, 2045, 2212, 1491, 1378, 1524, 1231, 1577, 2459, 1848, 1506, 1589, 1386, 1111, 1180, 1075, 1595, 1309, 2092, 1846, 2321, 2036, 3587, 1637, 1416, 1432, 1110, 1135, 1233, 1439, 894, 628, 967, 1176, 1069, 1193, 1771, 1199, 888, 1155, 1254, 1403, 1502, 1692, 1187, 1110, 1382, 1808, 2039, 1810, 1819, 1408, 803, 1568, 1227, 1270, 1268, 1535, 873, 1006, 1328, 1733, 1352, 1906, 2029, 1734, 1314, 1810, 1540, 1958, 1420, 1530, 1126, 721, 771, 874, 997, 1186, 1415, 973, 1146, 1147, 1079, 3854, 3407, 2257, 1200, 734, 1051, 1030, 1370, 2422, 1531, 1062, 530, 1030, 1061, 1249, 2080, 2251, 1190, 756, 1161, 1053, 1063, 932, 1604, 1130, 744, 930, 948, 1107, 1161, 1194, 1366, 1155, 785, 602, 903, 1142, 1410, 1256, 742, 985, 1037, 1067, 1196, 1412, 1127, 779, 911, 989, 946, 888, 1349, 1124, 761, 994, 1068, 971, 1157, 1558, 1223, 782, 2790, 1835, 1444, 1098, 1399, 1255, 950, 1110, 1345, 1224, 1092, 1446, 1210, 1122, 1259, 1181, 1035, 1325, 1481, 1278, 769, 911, 876, 877, 950, 1383, 980, 705, 888, 877, 638, 1065, 1142, 1090, 1316, 1270, 1048, 1256, 1009, 1175, 1176, 870, 856, 860])
    n_predict = 100
    extrapolation = fourierExtrapolation(x, n_predict)

    pl.figure()
    pl.plot(np.arange(len(x), len(extrapolation) + len(x)), extrapolation, 'r', label = 'extrapolation')
    pl.plot(x, 'b', label = 'Given Data', linewidth = 3)
    pl.legend()
    pl.ylabel('BPM')
    pl.xlabel('Sample')
    pl.title('Fourier Extrapolation')
    pl.savefig('FourierExtrapolation.png')
    #pl.show()
    with open('Fourier_PredValues.txt', 'w') as out:
        out.write(str([e for e in extrapolation]).strip('[]'))
random_walk.py 文件源码 项目:MIT-CS-lectures 作者: William-Python-King 项目源码 文件源码 阅读 51 收藏 0 点赞 0 评论 0
def ansQuest(maxTime,numTrials):
    means=[]
    distLists=performSim(maxTime,numTrials)
    for t in range(maxTime+1):
        tot=0.0
        for distL  in  distLists:
            tot+=distL[t]
        means.append(tot/len(distL))
    pylab.figure()
    pylab.plot(means)
    pylab.xlabel('distance')
    pylab.ylabel('time')
    pylab.title('Average Distance  vs. Time ('+str(len(distLists))+'trials)')
plot.py 文件源码 项目:spyking-circus 作者: spyking-circus 项目源码 文件源码 阅读 21 收藏 0 点赞 0 评论 0
def view_whitening(data):
    pylab.subplot(121)
    pylab.imshow(data['spatial'], interpolation='nearest')
    pylab.title('Spatial')
    pylab.xlabel('# Electrode')
    pylab.ylabel('# Electrode')
    pylab.colorbar()
    pylab.subplot(122)
    pylab.title('Temporal')
    pylab.plot(data['temporal'])
    pylab.xlabel('Time [ms]')
    x, y = pylab.xticks()
    pylab.xticks(x, (x-x[-1]//2)//10)
    pylab.tight_layout()


问题


面经


文章

微信
公众号

扫码关注公众号