コード例 #1
0
 def test1():
     fig,ax = subplots(nrows=3, ncols=2, apportion = [2,1,1])
     return
コード例 #2
0
            bb = ax.get_position().get_points()
            pos = bb.flatten() 
            # convert to x0,y0, dx, dy form by subtracting origin
            newh = height[i]*fracts[i]*nrows

            pos[1] = yabove - newh - above[i]
            pos[3] = newh
            pos[2] = pos[2] - pos[0]
            yabove = pos[1]
            if debug>0: print(pos)
            ax.set_position(pos)

    if squeeze: 
        if len(np.shape(axes[0]))==0: axes = axes.flatten()    
        if len(axes) == 1: axes = axes[0]
    return(fig, axes)

if __name__ == "__main__":
    from subplots import subplots
    fig,ax = subplots(nrows=3, apportion = [5,1,1])
    #fig,ax = pl.subplots(nrows=3)
    t = np.linspace(0,20)
    ax[0].plot(np.sin(t))
    ax[0].set_title('Ax0')
    ax[1].plot(np.cos(t))
    pl.show()
    print('try test1()')
    def test1():
        fig,ax = subplots(nrows=3, ncols=2, apportion = [2,1,1])
        return
コード例 #3
0
ファイル: cross_phase.py プロジェクト: bdb112/pyfusion
exec(process_cmd_line_args())

pf.config.set('global', 'localdatapath',
              os.path.join(pf.PYFUSION_ROOT_DIR, 'examples', 'JSPF_tutorial',
                           'local_data'))  # this line points to local data

if nr > 0:
    try:  # use my nicer version if it is available
        from subplots import subplots
        # close up space between graphs
        spkwargs = dict(apportion=[2, 1], spadj_kwargs=dict(hspace=0))
    except ImportError:
        from matplotlib.pyplot import subplots
        spkwargs = {}

    fig, axs = subplots(nrows=nr, ncols=1, sharex='all', **spkwargs)

if nr == 1:
    strtpair = 0
    ax1, ax2 = axs, axs
    plt.sca(ax2)
else:
    strtpair = 1
    ax1, ax2 = axs
    plt.sca(axs[0])

xlab = {1: 'Hz', 1000: 'kHz', 1000000: 'MHz'}[unit_freq]

if type(noverlap) != int:
    noverlap = int(noverlap * NFFT)
コード例 #4
0
ファイル: many_specs.py プロジェクト: bdb112/pyfusion
            khstr = '$\kappa_H$ {kh:.2f}'.format(kh=kh)

        try:
            rf_drive=h1tree.getNode('.RF:rf_drive').data()
        except:
            PFTop = h1tree.getNode('.RF:P_FWD_TOP').data()
            rf_drive = 1.3*5*np.sqrt(np.max(smooth_n(PFTop,500)/200.))

        if include_amplifier_sig:

            current_node = tree_name.getNode(mirnov)
            current_raw = current_node.record.data()

        nr = 1+include_ne+include_ne_spec+include_amplifier_sig
        
        (fig, ax) = subplots(nrows = nr, sharex='all', squeeze=False, **special_kws)

        rw = 0
        """
        rw = 1; nr += 1  # leave two spots for the specgram
        pos = msp.get_position().get_points().flatten()
        print(pos)
        msp.set_position([pos[0],pos[1]*2./nr,pos[2],pos[3]*nr/(nr-1.)])
        """
        msp = ax[rw,0]

        if include_amplifier_sig: 
            rw += 1
            asp = ax[rw, 0]

        if include_ne: 
コード例 #5
0
ファイル: cross_phase.py プロジェクト: bdb112/pyfusion
from pyfusion.utils import process_cmd_line_args
exec(process_cmd_line_args())

pf.config.set('global','localdatapath',os.path.join(pf.PYFUSION_ROOT_DIR,'examples','JSPF_tutorial','local_data')) # this line points to local data


if nr > 0:
    try:  # use my nicer version if it is available
        from subplots import subplots
        # close up space between graphs
        spkwargs=dict(apportion=[2,1],spadj_kwargs=dict(hspace=0))
    except ImportError:
        from matplotlib.pyplot import subplots
        spkwargs={}

    fig, axs = subplots(nrows=nr,ncols=1, sharex='all',**spkwargs)

if nr==1:
    strtpair = 0
    ax1, ax2 = axs, axs
    plt.sca(ax2)
else:
    strtpair = 1
    ax1, ax2 = axs
    plt.sca(axs[0])

xlab = {1:'Hz', 1000:'kHz', 1000000:'MHz'}[unit_freq] 

if type(noverlap) != int:
    noverlap = int(noverlap*NFFT)