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


Python Layout.showG方法代码示例

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


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

示例1: replay

# 需要导入模块: from pylayers.gis.layout import Layout [as 别名]
# 或者: from pylayers.gis.layout.Layout import showG [as 别名]
    def replay(self, fig=[], ax=[], **kwargs):
        """ replay a trajectory

        Parameters
        ----------

        fig
        ax

        speed : float
            speed ratio

        """

        # plt.ion()
        if fig == []:
            fig = plt.gcf()
        if ax == []:
            ax = plt.gca()

        limkwargs = copy.copy(kwargs)
        if "c" in kwargs:
            limkwargs.pop("c")
        if "color" in kwargs:
            limkwargs.pop("c")
        limkwargs["marker"] = "*"
        limkwargs["s"] = 20

        if ("m" or "marker") not in kwargs:
            kwargs["marker"] = "o"
        if ("c" or "color") not in kwargs:
            kwargs["color"] = "b"

        L = Layout(self.Lfilename)
        fig, ax = L.showG("s", fig=fig, ax=ax, **kwargs)

        time = self[0].time()

        line, = ax.plot([], [], "ob", lw=2)
        time_template = "time = %.1fs"
        time_text = ax.text(0.05, 0.9, "", transform=ax.transAxes)

        def init():
            line.set_data([], [])
            time_text.set_text("")
            return line, time_text

        def animate(it):
            X = []
            Y = []
            for t in self:
                if t.typ == "ag":
                    X.append(t["x"].values[it])
                    Y.append(t["y"].values[it])
            line.set_data(X, Y)
            time_text.set_text(time_template % (time[it]))
            return line, time_text

        ani = animation.FuncAnimation(fig, animate, np.arange(1, len(time)), interval=25, blit=True, init_func=init)
        plt.show()
开发者ID:pylayers,项目名称:pylayers,代码行数:62,代码来源:trajectory.py

示例2:

# 需要导入模块: from pylayers.gis.layout import Layout [as 别名]
# 或者: from pylayers.gis.layout.Layout import showG [as 别名]
try:
    L.dumpr()
except:
    L.build()
    L.dumpw()
#L.editor()
fig = plt.gcf()
#ax1  = fig.add_subplot(221)
ax1  = fig.add_subplot(321)
L.display['thin']=True
fig,ax1  = L.showGs(fig=fig,ax=ax1)
#L.display['edlabel']=True
#L.display['edlblsize']=50
# display selected segments
L.display['thin']=True
L.showG(fig=fig,ax=ax1,graph='t')
fig = plt.gcf()
ax1 = plt.gca()
fig,ax1 =  L.showGs(fig=fig,ax=ax1,edlist=[125],width=4)
ax11 = fig.add_subplot(322)
L.showG(fig=fig,ax=ax11,graph='')
#plt.savefig('graphGs.png')
#build topological graph 
ax2 = fig.add_subplot(323)
L.showG(fig=fig,ax=ax2,graph='t')
plt.title('Topological graph')
#plt.savefig('graphGt.png')
# build graph of rooms
ax3 = fig.add_subplot(324)
L.showG(fig=fig,ax=ax3,graph='r')
#plt.savefig('graphGr.png')
开发者ID:mlaaraie,项目名称:pylayers,代码行数:33,代码来源:test_layout.py

示例3: Coverage

# 需要导入模块: from pylayers.gis.layout import Layout [as 别名]
# 或者: from pylayers.gis.layout.Layout import showG [as 别名]

#.........这里部分代码省略.........
        --------

        .. plot::
            :include-source:

            >>> from pylayers.antprop.coverage import *
            >>> C = Coverage()
            >>> C.cover(polar='o')
            >>> f,a = C.show(typ='pr')
            >>> plt.show()
            >>> f,a = C.show(typ='best')
            >>> plt.show()
            >>> f,a = C.show(typ='loss')
            >>> plt.show()
            >>> f,a = C.show(typ='sinr')
            >>> plt.show()

        """
        defaults = { 'typ': 'pr',
                     'grid': False,
                     'f' : 0,
                     'a' :-1,
                     'db':True,
                     'cmap' :cm.jet,
                     'best':True
                   }

        title = self.dap[0].s.name+ ' : '
        for k in defaults:
            if k not in kwargs:
                kwargs[k]=defaults[k]

        if 'fig' in kwargs:
            fig,ax=self.L.showG('s',fig=kwargs['fig'])
        else:
            fig,ax=self.L.showG('s')

        # plot the grid
        if kwargs['grid']:
            for k in self.dap:
                p = self.dap[k].p
                ax.plot(p[0],p[1],'or')

        f = kwargs['f']
        a = kwargs['a']
        typ = kwargs['typ']
        best = kwargs['best']

        dB = kwargs['db']

        # setting the grid

        l = self.grid[0,0]
        r = self.grid[-1,0]
        b = self.grid[0,1]
        t = self.grid[-1,-1]

        if typ=='best':
            title = title + 'Best server'+' fc = '+str(self.fGHz[f])+' GHz'+ ' polar : '+self.polar
            for ka in range(self.na):
                bestsv =  self.bestsv[f,:,ka]
                m = np.ma.masked_where(bestsv == 0,bestsv)
                W = m.reshape(self.nx,self.ny).T
                ax.imshow(W, extent=(l,r,b,t),
                            origin='lower',
                            vmin=1,
开发者ID:niamiot,项目名称:pylayers,代码行数:70,代码来源:coverage.py

示例4: Coverage

# 需要导入模块: from pylayers.gis.layout import Layout [as 别名]
# 或者: from pylayers.gis.layout.Layout import showG [as 别名]

#.........这里部分代码省略.........
        typ : string
            'pr' | 'sinr' | 'capacity' | 'loss' | 'best' | 'egd'
        grid : boolean
        polar : string
            'o' | 'p'
        best : boolean
            draw best server contour if True
        f : int
            frequency index
        a : int
            access point index (-1 all access point)

        Examples
        --------

        .. plot::
            :include-source:

            >>> from pylayers.antprop.coverage import *
            >>> C = Coverage()
            >>> C.cover()
            >>> f,a = C.show(typ='pr',figsize=(10,8))
            >>> plt.show()
            >>> f,a = C.show(typ='best',figsize=(10,8))
            >>> plt.show()
            >>> f,a = C.show(typ='loss',figsize=(10,8))
            >>> plt.show()
            >>> f,a = C.show(typ='sinr',figsize=(10,8))
            >>> plt.show()

        See Also
        --------

        pylayers.gis.layout.Layout.showG

        """
        defaults = { 'typ': 'pr',
                     'grid': False,
                     'polar':'p',
                     'f' : 0,
                     'a' :-1,
                     'db':True,
                     'cmap' :cm.jet,
                     'best':True
                   }

        title = self.dap[1].s.name+ ' : '

        for k in defaults:
            if k not in kwargs:
                kwargs[k]=defaults[k]
        polar = kwargs['polar']
        if 'fig' in kwargs:
            if 'ax' in kwargs:
                fig,ax=self.L.showG('s',fig=kwargs['fig'],ax=kwargs['ax'])
            else:
                fig,ax=self.L.showG('s',fig=kwargs['fig'])
        else:
            if 'figsize' in kwargs:
                fig,ax=self.L.showG('s',figsize=kwargs['figsize'])
            else:
                fig,ax=self.L.showG('s')

        # plot the grid
        if kwargs['grid']:
            for k in self.dap:
开发者ID:ahrovat,项目名称:pylayers,代码行数:70,代码来源:coverage.py

示例5: ishow

# 需要导入模块: from pylayers.gis.layout import Layout [as 别名]
# 或者: from pylayers.gis.layout.Layout import showG [as 别名]
    def ishow(self):
        """
            interactive show of trajectories

        Examples
        --------

        .. plot::
            :include-source:

            >>> from pylayers.mobility.trajectory import *
            >>> T=Trajectories()
            >>> T.loadh5()
            >>> T.ishow()

        """

        fig, ax = plt.subplots()
        fig.subplots_adjust(bottom=0.2, left=0.3)

        t = np.arange(0, len(self[0].index), self[0].ts)
        L = Layout(self.Lfilename)
        fig, ax = L.showG('s', fig=fig, ax=ax)

        valinit = 0
        lines = []
        labels = []
        colors = "bgrcmykw"

        for iT, T in enumerate(self):
            if T.typ == 'ag':
                lines.extend(ax.plot(T['x'][0:valinit],T['y'][0:valinit], 'o',
                             color=colors[iT], visible=True))
                labels.append(T.name + ':' + T.ID)
            else:
                lines.extend(ax.plot(T['x'][0], T['y'][0], '^', ms=12,
                             color=colors[iT], visible=True))
                labels.append(T.name + ':' + T.ID)

        t = self[0].time()

        # init boolean value for visible in checkbutton
        blabels = [True]*len(labels)


        ########
        # slider
        ########
        slider_ax = plt.axes([0.1, 0.1, 0.8, 0.02])
        slider = Slider(slider_ax, "time", self[0].tmin, self[0].tmax,
                        valinit=valinit, color='#AAAAAA')

        def update(val):
            if val >= 1:
                pval=np.where(val>t)[0]
                ax.set_title(str(self[0].index[pval[-1]].time())[:11].ljust(12),
                             loc='left')
                for iT, T in enumerate(self):
                    if T.typ == 'ag':
                        lines[iT].set_xdata(T['x'][pval])
                        lines[iT].set_ydata(T['y'][pval])
                fig.canvas.draw()
        slider.on_changed(update)


        ########
        # choose
        ########
        rax = plt.axes([0.02, 0.5, 0.3, 0.2], aspect='equal')
        # check (ax.object, name of the object , bool value for the obsject)
        check = CheckButtons(rax, labels, tuple(blabels))

        def func(label):
            i = labels.index(label)
            lines[i].set_visible(not lines[i].get_visible())
            fig.canvas.draw()

        check.on_clicked(func)
        fig.canvas.draw()
        plt.show(fig)
开发者ID:mkyas,项目名称:pylayers,代码行数:82,代码来源:trajectory.py

示例6: replay

# 需要导入模块: from pylayers.gis.layout import Layout [as 别名]
# 或者: from pylayers.gis.layout.Layout import showG [as 别名]
    def replay(self, fig=[], ax=[], **kwargs):
        """ replay a trajectory

        Parameters
        ----------

        fig
        ax

        speed : float
            speed ratio

        """

        # plt.ion()
        if fig==[]:
            fig = plt.gcf()
        if ax == []:
            ax = plt.gca()

        limkwargs = copy.copy(kwargs)
        if 'c' in kwargs:
            limkwargs.pop('c')
        if 'color'in kwargs:
            limkwargs.pop('c')
        limkwargs['marker'] = '*'
        limkwargs['s'] = 20

        if ('m' or 'marker') not in kwargs:
            kwargs['marker'] = 'o'
        if ('c' or 'color') not in kwargs:
            kwargs['color'] = 'b'

        L=Layout(self.Lfilename)
        fig, ax = L.showG('s',fig=fig, ax=ax, **kwargs)

        time=self[0].time()


        line, = ax.plot([], [], 'ob', lw=2)
        time_template = 'time = %.1fs'
        time_text = ax.text(0.05, 0.9, '', transform=ax.transAxes)

        def init():
            line.set_data([],[])
            time_text.set_text('')
            return line, time_text

        def animate(it):
            X=[]
            Y=[]
            for t in self:
                if t.typ == 'ag':
                    X.append(t['x'].values[it])
                    Y.append(t['y'].values[it])
            line.set_data(X,Y)
            time_text.set_text(time_template%(time[it]))
            return line, time_text

        ani = animation.FuncAnimation(fig, animate, np.arange(1, len(time)),
            interval=25, blit=True, init_func=init)
        plt.show()
开发者ID:mkyas,项目名称:pylayers,代码行数:64,代码来源:trajectory.py

示例7: Layout

# 需要导入模块: from pylayers.gis.layout import Layout [as 别名]
# 或者: from pylayers.gis.layout.Layout import showG [as 别名]
from pylayers.gis.layout import Layout
import networkx as nx
import matplotlib.pyplot as plt
import doctest

plt.ion()
#doctest.testmod(layout)
#L = Layout('TA-Office.ini')
L = Layout('WHERE1.ini')
#L= Layout('11Dbibli.ini')
#L.show()
#L = Layout('PTIN.ini')
#L = Layout('DLR.ini')
#L.build()
L.dumpr()
L.showG('i',en=11)
#Ga = L.buildGr()
#L.showGs()
#nx.draw(Ga,Ga.pos)
开发者ID:Dialloalha,项目名称:pylayers,代码行数:21,代码来源:test_showGi.py

示例8: Simul

# 需要导入模块: from pylayers.gis.layout import Layout [as 别名]
# 或者: from pylayers.gis.layout.Layout import showG [as 别名]

#.........这里部分代码省略.........
            furniture  : boolean for METALIC furniture display
            s          : scale fir scatter plot  (default 8)
            c          : color for scatter plot  (default 'b')
            traj       : boolean  (def False)
            num        : boolean  (def False)
                display a number


            Examples
            --------
            >>> import matplotlib.pyplot as plt
            >>> from pylayers.simul.simulem import *
            >>> S = Simul()
            >>> S.load('w1.ini')
            >>> S.L.loadfur('FurW1.ini')
            >>> S.show()
            >>> plt.show()



        """
        if type(itx) == int:
            itx = [itx]
        if type(irx) == int:
            irx = [irx]


        if fig ==[]:
            fig = plt.gcf()
        if ax==[]:
            ax = fig.gca()

        #self.L.display['scaled']=False
        fig,ax=self.L.showG('s',fig=fig,ax=ax, aw=True)
        #
        if furniture:
            if 'lfur' in self.L.__dict__:
                for fur in self.L.lfur:
                    if fur.Matname == 'METAL':
                        fur.show(fig, ax)
            else:
                print "Warning : no furniture file loaded"

        if irx[0] == -1:
            ax.scatter(self.rx.position[0,:],
                       self.rx.position[1,:], c='b', s=s, alpha=0.5)
            #ax.scatter(self.rx.position[0,0],self.rx.position[0,1],c='k',s=s,linewidth=0)
            #ax.scatter(self.rx.position[1,0],self.rx.position[1,1],c='b',s=s,linewidth=0)
            #ax.scatter(self.rx.position[2,0],self.rx.position[2,1],c='g',s=s,linewidth=0)
            #ax.scatter(self.rx.position[3,0],self.rx.position[3,1],c='c',s=s,linewidth=0)
        else:
            for k in irx:
                ax.scatter(self.rx.position[0,k - 1],
                           self.rx.position[1,k - 1], c='b', s=s, alpha=0.5)
                if num:
                    ax.text(self.rx.position[0,k - 1],
                            self.rx.position[1,k - 1],
                            str(k), color='blue')

        if itx[0] == -1:
            ax.scatter(self.tx.position[0,:],
                       self.tx.position[1,:], c='r', s=s)
        else:
            if traj:
                cpt = 1
            for k in itx:
开发者ID:,项目名称:,代码行数:70,代码来源:

示例9: Layout

# 需要导入模块: from pylayers.gis.layout import Layout [as 别名]
# 或者: from pylayers.gis.layout.Layout import showG [as 别名]
L = Layout('TA-Office.ini')
#L = Layout('DLR.ini')
#L = Layout('TA-Office.ini')
#L = Layout('WHERE1.ini')
try:
    L.dumpr()
except:
    L.build()
    L.dumpw()
#L.editor()
fig = plt.gcf()
#ax1  = fig.add_subplot(221)
ax1  = fig.add_subplot(321)
L.display['thin']=True
fig,ax1  = L.showG(graph='s',fig=fig,ax=ax1)
#L.display['edlabel']=True
#L.display['edlblsize']=50
# display selected segments
L.display['thin']=True
L.showG(fig=fig,ax=ax1,graph='t')
fig = plt.gcf()
ax1 = plt.gca()
fig,ax1 =  L.showGs(fig=fig,ax=ax1,edlist=[125],width=4)
ax11 = fig.add_subplot(322)
L.showG(fig=fig,ax=ax11,graph='s')
#plt.savefig('graphGs.png')
#build topological graph 
ax2 = fig.add_subplot(323)
L.showG(fig=fig,ax=ax2,graph='t')
plt.title('Topological graph')
开发者ID:Dialloalha,项目名称:pylayers,代码行数:32,代码来源:ex_layout.py

示例10: Layout

# 需要导入模块: from pylayers.gis.layout import Layout [as 别名]
# 或者: from pylayers.gis.layout.Layout import showG [as 别名]
import matplotlib.pyplot as plt
import warnings
import shutil

warnings.filterwarnings("error")

#doctest.testmod(layout)
#L = Layout('TA-Office.ini')
L =  Layout()
lL = L.ls()
for tL in lL:
    print  'Layout :     ',tL
    print  '--------------------------'
    if 'Munich' not in tL:
        L = Layout(tL,bbuild=0,bgraphs=0)
        f,a = L.showG('s')
        plt.title(tL,fontsize=32)
        plt.show()
        plt.close('all')
    #if L.check():
    #    L.save()
        #filein = pyu.getlong(L._filename, pstruc['DIRLAY'])
        #fileout = '/home/uguen/Documents/rch/devel/pylayers/data/struc/lay/'+L._filename
        #print fileout
        #shutil.copy2(filein,fileout)
#figure(figsize=(20,10))
#plt.axis('off')
#f,a = L.showG('s',nodes=False,fig=f)
#plt.show()
#f,a = L.showG('r',edge_color='b',linewidth=4,fig=f)
#L= Layout('11Dbibli.ini')
开发者ID:dialounke,项目名称:pylayers,代码行数:33,代码来源:test_layout.py


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