Пример #1
0
    def show(self, ax=None):
        """
        show the graph as a planar graph
        
        Parameters
        ----------
        ax, axis handle
        
        Returns
        -------
        ax, axis handle
        """
        import matplotlib.pylab as mp
        if ax==None:
            mp.figure()
            ax = np.subplot(1,1,1)

        t = (2*np.pi*np.arange(self.V))/self.V
        mp.plot(np.cos(t),np.sin(t),'.')
        for e in range(self.E):
            A = (self.edges[e,0]*2*np.pi)/self.V
            B = (self.edges[e,1]*2*np.pi)/self.V
            ax.plot([np.cos(A),np.cos(B)],[np.sin(A),np.sin(B)],'k')
        ax.axis('off')
        return ax
Пример #2
0

def empty_grid(ax=None):
    if ax is None:
        ax = plt.gca()
    ax.xaxis.set_ticks([])
    ax.yaxis.set_ticks([])
    ax.set_frame_on(False)
    ax.axis("equal")
    ax.axis([-1.01, 1.01, -1.01, 1.01])
    return ax


if __name__ == "__main__":
    plt.clf()
    ax1 = np.subplot(331)
    smith(ax1)
    ax2 = np.subplot(332)
    inv_smith(ax2)
    ax3 = np.subplot(333)
    smith_polar(ax3)

    ax4 = np.subplot(334)
    empty_grid(ax4)
    smith_grid(ax4)
    smith_grid(ax4, standard=False)

    ax5 = np.subplot(335)
    empty_grid(ax5)
    polar_grid(ax5)
Пример #3
0
    polar_grid(ax, "upper")


def empty_grid(ax=None):
    if ax is None:
        ax = plt.gca()
    ax.xaxis.set_ticks([])
    ax.yaxis.set_ticks([])
    ax.set_frame_on(False)
    ax.axis("equal")
    ax.axis([-1.01, 1.01, -1.01, 1.01])
    return ax

if __name__ == "__main__":
    plt.clf()
    ax1 = np.subplot(331)
    smith(ax1)
    ax2 = np.subplot(332)
    inv_smith(ax2)
    ax3 = np.subplot(333)
    smith_polar(ax3)

    ax4 = np.subplot(334)
    empty_grid(ax4)
    smith_grid(ax4)
    smith_grid(ax4, standard=False)

    ax5 = np.subplot(335)
    empty_grid(ax5)
    polar_grid(ax5)