Skip to content

Instantly share code, notes, and snippets.

@odebeir
Created August 4, 2010 12:54
Show Gist options
  • Save odebeir/508082 to your computer and use it in GitHub Desktop.
Save odebeir/508082 to your computer and use it in GitHub Desktop.
from enthought.enable.api import ComponentEditor, BaseTool
from enthought.chaco.api import ArrayPlotData, Plot, jet, gray, PlotGraphicsContext
from enthought.traits.api import HasTraits, Instance, Enum, Range, Dict, Button, Int, Bool, Str, Property,Event, Array, DelegatesTo, on_trait_change,List, Tuple
from enthought.traits.ui.api import Item, Group, View, InstanceEditor
def draw_plot(filename, container,size=(800,600)):
"""Render a plot to file"""
container.outer_bounds = list(size)
container.do_layout(force=True)
gc = PlotGraphicsContext(size, dpi=150)
gc.render_component(container)
gc.save(filename)
return
if __name__ == '__main__':
pass
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment