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


Python PlotGraphicsContext.render_component方法代码示例

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


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

示例1: save_plot

# 需要导入模块: from chaco.api import PlotGraphicsContext [as 别名]
# 或者: from chaco.api.PlotGraphicsContext import render_component [as 别名]
def save_plot(plot, filename, width, height):
    plt_bounds = plot.outer_bounds
    plot.do_layout(force=True)
    gc = PlotGraphicsContext(plt_bounds, dpi=72)
    gc.render_component(plot)
    gc.save(filename)
    print "Plot saved to: ", filename
开发者ID:AttilaForgacs,项目名称:experimental,代码行数:9,代码来源:chaco_mpt_display.py

示例2: _SaveFlag_changed

# 需要导入模块: from chaco.api import PlotGraphicsContext [as 别名]
# 或者: from chaco.api.PlotGraphicsContext import render_component [as 别名]
    def _SaveFlag_changed(self):	
	DPI = 72
	print '--------------Save Initiated------------------'
	
	#Main plot save code
	size = (self.IntensityData[:,:,self.intensityindex].shape[0]*4, self.IntensityData[:,:,self.intensityindex].shape[1]*4)
	path = os.getenv('PWD')
	filenamelist = [path, '/', 'MainPlot_WaveLen', str(self.Wavelength).replace('.','_'), '.png']
	filename = ''.join(filenamelist)
	container = self.Main_img_plot
	temp = container.outer_bounds
	container.outer_bounds = list(size)
	container.do_layout(force=True)
	gc = PlotGraphicsContext(size, dpi=DPI)
	gc.render_component(container)
	gc.save(filename)
	container.outer_bounds = temp
	print "SAVED: ", filename
	
	#Spectra plot save code
	size = (1000,500)
	path = os.getenv('PWD')
	filenamelist = [path, '/', 'SpectraPlot_X', str(self.InspectorPosition[0]), '_Y', str(self.InspectorPosition[1]), '.png']
	filename = ''.join(filenamelist)
	container = self.Spectraplot1
	temp = container.outer_bounds
	container.outer_bounds = list(size)
	container.do_layout(force=True)
	gc = PlotGraphicsContext(size, dpi=DPI)
	gc.render_component(container)
	gc.save(filename)
	container.outer_bounds = temp
	print "SAVED: ", filename
	return
开发者ID:peterlandgren,项目名称:NCDF-Viewer,代码行数:36,代码来源:NCDFViewer.py

示例3: save_plot

# 需要导入模块: from chaco.api import PlotGraphicsContext [as 别名]
# 或者: from chaco.api.PlotGraphicsContext import render_component [as 别名]
def save_plot(plot, filename, width, height):
    # http://docs.enthought.com/chaco/user_manual/how_do_i.html
    from chaco.api import PlotGraphicsContext
    plot.outer_bounds = [width, height]
    plot.do_layout(force=True)
    gc = PlotGraphicsContext((width, height), dpi=72)
    gc.render_component(plot)
    gc.save(filename)
开发者ID:tkf,项目名称:mplchaco,代码行数:10,代码来源:demo.py

示例4: test_scatter_1d_selection

# 需要导入模块: from chaco.api import PlotGraphicsContext [as 别名]
# 或者: from chaco.api.PlotGraphicsContext import render_component [as 别名]
    def test_scatter_1d_selection(self):
        self.scatterplot.index.metadata['selections'] = [
            (arange(10) % 2 == 0),
        ]

        gc = PlotGraphicsContext(self.size)
        gc.render_component(self.scatterplot)
        actual = gc.bmp_array[:, :, :]
        self.assertFalse(alltrue(actual == 255))
开发者ID:binaryannamolly,项目名称:chaco,代码行数:11,代码来源:line_scatterplot_test_case.py

示例5: _save_plot

# 需要导入模块: from chaco.api import PlotGraphicsContext [as 别名]
# 或者: from chaco.api.PlotGraphicsContext import render_component [as 别名]
 def _save_plot(self, plot, filename, width=800, height=600, dpi=72):
     self.set_plot_title(plot, self.plot_title)
     original_outer_bounds = plot.outer_bounds
     plot.outer_bounds = [width, height]
     plot.do_layout(force=True)
     gc = PlotGraphicsContext((width, height), dpi=dpi)
     gc.render_component(plot)
     gc.save(filename)
     plot.outer_bounds = original_outer_bounds
开发者ID:magnunor,项目名称:analyzarr,代码行数:11,代码来源:save_plot.py

示例6: _save

# 需要导入模块: from chaco.api import PlotGraphicsContext [as 别名]
# 或者: from chaco.api.PlotGraphicsContext import render_component [as 别名]
    def _save(self):
        # Create a graphics context of the right size
        win_size = self.plot.outer_bounds
        plot_gc = PlotGraphicsContext(win_size)

        # Have the plot component into it
        plot_gc.render_component(self.plot)

        # Save out to the user supplied filename
        plot_gc.save(self._save_file)
开发者ID:enthought,项目名称:chaco,代码行数:12,代码来源:image_from_file.py

示例7: test_scatter_1d

# 需要导入模块: from chaco.api import PlotGraphicsContext [as 别名]
# 或者: from chaco.api.PlotGraphicsContext import render_component [as 别名]
    def test_scatter_1d(self):
        self.assertEqual(self.scatterplot.origin, 'bottom left')
        self.assertIsNone(self.scatterplot.x_mapper)
        self.assertEqual(self.scatterplot.y_mapper,
                         self.scatterplot.index_mapper)

        gc = PlotGraphicsContext(self.size)
        gc.render_component(self.scatterplot)
        actual = gc.bmp_array[:, :, :]
        self.assertFalse(alltrue(actual == 255))
开发者ID:enthought,项目名称:chaco,代码行数:12,代码来源:text_plot_1d_test_case.py

示例8: test_scatter_1d_selection_mask_name

# 需要导入模块: from chaco.api import PlotGraphicsContext [as 别名]
# 或者: from chaco.api.PlotGraphicsContext import render_component [as 别名]
    def test_scatter_1d_selection_mask_name(self):
        # select with a mask
        self.scatterplot.selection_metadata_name = 'highlight_masks'
        self.scatterplot.index.metadata['highlight_masks'] = [
            (arange(10) % 2 == 0),
        ]

        gc = PlotGraphicsContext(self.size)
        gc.render_component(self.scatterplot)
        actual = gc.bmp_array[:, :, :]
        self.assertFalse(alltrue(actual == 255))
开发者ID:binaryannamolly,项目名称:chaco,代码行数:13,代码来源:line_scatterplot_test_case.py

示例9: test_scatter_fast

# 需要导入模块: from chaco.api import PlotGraphicsContext [as 别名]
# 或者: from chaco.api.PlotGraphicsContext import render_component [as 别名]
 def test_scatter_fast(self):
     """ Coverage test to check basic case works """
     size = (50, 50)
     scatterplot = create_scatter_plot(
         data=[range(10), range(10)],
         border_visible=False,
     )
     scatterplot.outer_bounds = list(size)
     gc = PlotGraphicsContext(size)
     gc.render_component(scatterplot)
     actual = gc.bmp_array[:, :, :]
     self.assertFalse(alltrue(actual == 255))
开发者ID:SDiot,项目名称:chaco,代码行数:14,代码来源:scatterplot_renderers_test_case.py

示例10: plotRU

# 需要导入模块: from chaco.api import PlotGraphicsContext [as 别名]
# 或者: from chaco.api.PlotGraphicsContext import render_component [as 别名]
    def plotRU(self,rangeX=None, rangeY=None, save=False, filename=""):
        if save and filename == "":
            self.add_line("ERROR: I need a valid file name")
            return

        if save and filename.split('.')[-1] != "png":
            self.add_line("ERROR: File must end in .png")
            return

        if len(self.morseList) > 0:
            plotData = ArrayPlotData(x=self.Rlist, y=self.Ulist, morse=self.morseList, eigX=[self.Rlist[0], self.Rlist[-1]])
        else:
            plotData = ArrayPlotData(x=self.Rlist, y=self.Ulist)


        for val in self.levelsToFind:
            if val < len(self.convergedValues):
                plotData.set_data("eig"+str(val), [self.convergedValues[val], self.convergedValues[val]])

        plot = Plot(plotData)

        if len(self.morseList) > 0:
            plot.plot(("x","morse"), type = "line", color = "red")

        for val in self.levelsToFind:
            if val < len(self.convergedValues):

                plot.plot(("eigX","eig"+str(val)), type="line", color="green")

        plot.plot(("x","y"), type = "line", color = "blue")
        plot.plot(("x","y"), type = "scatter", marker_size = 1.0, color = "blue")
        #
        plot.index_axis.title = "Separation (r0)"
        if (self.scaled):
            plot.value_axis.title = "Potential (Eh * 2 * mu)"
        else:
            plot.value_axis.title = "Potential (Eh)"

        if len(self.plotRangeX) != 0:
            plot.x_axis.mapper.range.low = self.plotRangeX[0]
            plot.x_axis.mapper.range.high = self.plotRangeX[1]
        if len(self.plotRangeY) != 0:
            plot.y_axis.mapper.range.low = self.plotRangeY[0]
            plot.y_axis.mapper.range.high = self.plotRangeY[1]
        if not save:
            self.plot = plot
        else:
            plot.outer_bounds = [800,600]
            plot.do_layout(force=True)
            gc = PlotGraphicsContext((800,600), dpi = 72)
            gc.render_component(plot)
            gc.save(filename)
开发者ID:BackgroundNose,项目名称:Vibromatic,代码行数:54,代码来源:quantumWobbler.py

示例11: test_scatter_circle

# 需要导入模块: from chaco.api import PlotGraphicsContext [as 别名]
# 或者: from chaco.api.PlotGraphicsContext import render_component [as 别名]
 def test_scatter_circle(self):
     """ Coverage test to check circles work """
     size = (50, 50)
     scatterplot = create_scatter_plot(
         data=[list(sm.xrange(10)), list(sm.xrange(10))],
         marker="circle",
         border_visible=False,
     )
     scatterplot.outer_bounds = list(size)
     gc = PlotGraphicsContext(size)
     gc.render_component(scatterplot)
     actual = gc.bmp_array[:, :, :]
     self.assertFalse(alltrue(actual == 255))
开发者ID:enthought,项目名称:chaco,代码行数:15,代码来源:scatterplot_renderers_test_case.py

示例12: test_scatter_1d_horizontal_flipped

# 需要导入模块: from chaco.api import PlotGraphicsContext [as 别名]
# 或者: from chaco.api.PlotGraphicsContext import render_component [as 别名]
    def test_scatter_1d_horizontal_flipped(self):
        self.scatterplot.direction = 'flipped'
        self.scatterplot.orientation = 'h'

        self.assertEqual(self.scatterplot.origin, 'bottom right')
        self.assertEqual(self.scatterplot.x_mapper,
                         self.scatterplot.index_mapper)
        self.assertIsNone(self.scatterplot.y_mapper)

        gc = PlotGraphicsContext(self.size)
        gc.render_component(self.scatterplot)
        actual = gc.bmp_array[:, :, :]
        self.assertFalse(alltrue(actual == 255))
开发者ID:enthought,项目名称:chaco,代码行数:15,代码来源:text_plot_1d_test_case.py

示例13: test_scatter_1d_custom

# 需要导入模块: from chaco.api import PlotGraphicsContext [as 别名]
# 或者: from chaco.api.PlotGraphicsContext import render_component [as 别名]
    def test_scatter_1d_custom(self):
        path = CompiledPath()
        path.move_to(-5, -5)
        path.line_to(5, 5)
        path.line_to(5, -5)
        path.line_to(-5, 5)
        path.line_to(-5, -5)

        self.scatterplot.marker = 'custom'
        self.scatterplot.custom_symbol = path
        gc = PlotGraphicsContext(self.size)
        gc.render_component(self.scatterplot)
        actual = gc.bmp_array[:, :, :]
        self.assertFalse(alltrue(actual == 255))
开发者ID:enthought,项目名称:chaco,代码行数:16,代码来源:jitterplot_test_case.py

示例14: on_savefig

# 需要导入模块: from chaco.api import PlotGraphicsContext [as 别名]
# 或者: from chaco.api.PlotGraphicsContext import render_component [as 别名]
    def on_savefig(self):
        """ Handles the user requesting that the image of the 
            function is to be saved.
        """
        import os
        dlg = FileDialog(parent=self.control,
                         title='Save as image',
                         default_directory=os.getcwd(),
                         default_filename="", wildcard=WILDCARD,
                         action='save as')
        if dlg.open() == OK:
            path = dlg.path

            print "Saving plot to", path, "..."
            try:

                """ Now we create a canvas of the appropriate size and 
                    ask it to render our component.  
                   (If we wanted to display this plot in a window, we
                    would not need to create the graphics context ourselves; 
                    it would be created for us by the window.)
                """
#                self._plot.bounds = [500,300]
#                self._plot.padding = 50
               # plot_gc = PlotGraphicsContext(self._plot.outer_bounds)
               # plot_gc.render_component(self._plot)

                #self._plot_container.outer_bounds = list((800,600))
#                plot_gc = PlotGraphicsContext((400,300), dpi=72.0)
#                plot_gc.render_component(self._plot_container)

                self.lplot.bounds = [500, 300]
                self.lplot.padding = 50

                win_size = self.lplot.outer_bounds
                plot_gc = PlotGraphicsContext(win_size)

                # Have the plot component into it
                plot_gc.render_component(self.lplot)

                # Finally, we tell the graphics context
                # to save itself to disk as an image.
                plot_gc.save(path)

            except:
                print "Error saving!"
                raise
            print "Plot saved."
        return
开发者ID:simvisage,项目名称:mxn,代码行数:51,代码来源:mfn_chaco_editor.py

示例15: draw_plot

# 需要导入模块: from chaco.api import PlotGraphicsContext [as 别名]
# 或者: from chaco.api.PlotGraphicsContext import render_component [as 别名]
def draw_plot(filename, size=(800,600), num_plots=8, type='line', key=''):
    """ Save the plot, and generate the hover_data file. """
    container = create_plot(num_plots, type)
    container.outer_bounds = list(size)
    container.do_layout(force=True)
    gc = PlotGraphicsContext(size, dpi=DPI)
    gc.render_component(container)
    if filename:
        gc.save(filename)
        script_filename = filename[:-4] + "_png_hover_data.js"
    else:
        script_filename = None
    plot = make_palettized_png_str(gc)
    script_data = write_hover_coords(container, key, script_filename)
    return (plot, script_data)
开发者ID:enthought,项目名称:chaco,代码行数:17,代码来源:javascript_hover_tools.py


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