    def _draw(self):
        g2 = self.g.copy()
        g2.clear_edges()
        output = os.path.join('frames2','p{0}.png'.format(self.part))
        gt.graph_draw(g2, pos=self.vprop_pos,vertex_fill_color=self.vprop_color,
                vertex_size=20,vertex_color=self.vprop_color,vertex_halo_size=1.5,
                vertex_halo=True,vertex_halo_color=self.vprop_halo_color, bg_color=[1.,1.,1.,1.],mplfig=self.mplfig)#,output=output)
        #print 'drawing'
        plt.savefig(output,bbox_inches='tight')#,dpi=self.fig.dpi)
        #self.fig.canvas.print_png(output)
        
        def _get_mplfig(self,w,h):
            font0 = FontProperties()
            font1 = font0.copy()
            font1.set_weight('bold')
            yvalues = [self.cy + r * np.sin(90.* (np.pi/180.)) for r in self.rs]
            ymax = yvalues[-1]
            x_center = w/2
            x = [x_center]*len(yvalues)
            fig = plt.figure(figsize=(w,h))

            plt.vlines(x=x_center, ymin=h/2, ymax=ymax, color='black', zorder=3,alpha=0.7)
            for i in xrange(len(yvalues)):
                y = yvalues[i]
                k_index = self.r_k_dict[self.rs[i]]
                if i%5==0:
                    plt.hlines(y=y, xmin=x_center, xmax=x_center+2, color='black', zorder=3,alpha=1)
                    plt.text(x_center+4, y-0.8, str(k_index),color='green',fontsize=20,fontproperties=font1)
                else:
                    plt.hlines(y=y, xmin=x_center-1, xmax=x_center, color='black', zorder=3,alpha=0.9)

            frame1 = plt.gca()
            frame1.axes.get_xaxis().set_visible(False)
            frame1.axes.get_yaxis().set_visible(False)
            return fig
            
    def run(self, w=20,h=20):
        self.mplfig = self._get_mplfig(w,h)
 
        for t in xrange(3):
            do_stuff()
            self._draw()
 