예제 #1
0
def draw_svg(filename, size=(800, 600)):
    from chaco.svg_graphics_context import SVGGraphicsContext
    container = create_plot()
    container.bounds = list(size)
    container.do_layout(force=True)
    gc = SVGGraphicsContext(size)
    gc.render_component(container)
    gc.save(filename)
예제 #2
0
def draw_svg(filename, size=(800, 600)):
    from chaco.svg_graphics_context import SVGGraphicsContext
    container = create_plot()
    container.bounds = list(size)
    container.do_layout(force=True)
    gc = SVGGraphicsContext(size)
    gc.render_component(container)
    gc.save(filename)
예제 #3
0
파일: Plot.py 프로젝트: kr2/TouchIT-Log
    def _svg_export_fired(self):
        outfileName = self._getFilePath(defFileName=self.__DEF_FILE_NAME + '.svg')

        if outfileName != None:
            from chaco.svg_graphics_context import SVGGraphicsContext
            container = self.plot
            tempSize = copy.deepcopy( container.outer_bounds )
            container.outer_bounds = list((self.width,self.height))
            container.do_layout(force=True)
            gc = SVGGraphicsContext((self.width,self.height))
            gc.render_component(container)
            gc.save( outfileName )
            container.outer_bounds = tempSize
            self.plot.request_redraw()
예제 #4
0
def export_plot_svg(parent):
    dlg = wx.FileDialog(parent, "Export plot as SVG",
                        parent.config.get_path("SVG"), "",
                        "SVG file" + " (*.svg)|*.svg",
                        wx.FD_SAVE | wx.FD_OVERWRITE_PROMPT)
    if dlg.ShowModal() == wx.ID_OK:
        path = dlg.GetPath().encode("utf-8")
        if not path.endswith(".svg"):
            path += ".svg"
        parent.config.set_path(os.path.dirname(path), "SVG")
        container = parent.PlotArea.mainplot.container

        retol = hide_scatter_inspector(container)

        container.do_layout(force=True)
        plot = container.components[0]
        gc = SVGGraphicsContext(plot.outer_bounds)
        gc.render_component(plot.components[-1])
        #Start a new page for subsequent draw commands.
        gc.save(path)

        if retol is not None:
            retol.visible = True
예제 #5
0
def export_plot_svg(parent):
    dlg = wx.FileDialog(parent, "Export plot as SVG", 
                        parent.config.get_path("SVG"), "",
                        "SVG file"+" (*.svg)|*.svg",
                        wx.FD_SAVE|wx.FD_OVERWRITE_PROMPT)
    if dlg.ShowModal() == wx.ID_OK:
        path = dlg.GetPath().encode("utf-8")
        if not path.endswith(".svg"):
            path += ".svg"
        parent.config.set_path(os.path.dirname(path), "SVG")
        container = parent.PlotArea.mainplot.container

        retol = hide_scatter_inspector(container)
       
        container.do_layout(force=True)
        plot = container.components[0]
        gc = SVGGraphicsContext(plot.outer_bounds)
        gc.render_component(plot.components[-1])
        #Start a new page for subsequent draw commands.
        gc.save(path)

        if retol is not None:
            retol.visible = True
예제 #6
0
def save_plot_svg(component, filename, size):
    from chaco.svg_graphics_context import SVGGraphicsContext

    gc = SVGGraphicsContext(size)
    gc.render_component(component)
    gc.save(filename)