chaco.pdf_graphics_context module

class chaco.pdf_graphics_context.PdfPlotGraphicsContext(pdf_canvas=None, filename=None, pagesize=None, dest_box=None, dest_box_units=None)

Bases: kiva.pdf.GraphicsContext

A convenience class for rendering PlotComponents onto PDF

add_page()

Adds a new page to the PDF canvas and makes that the current drawing target.

dest_box = (0.5, 0.5, -0.5, -0.5)
dest_box_units = 'inch'
filename = 'saved_plot.pdf'
pagesize = 'letter'
render_component(component, container_coords=False, halign='center', valign='top')

Erases the current contents of the graphics context and renders the given component at the maximum possible scaling while preserving aspect ratio.

Parameters
  • component (Component) – The component to be rendered.

  • container_coords (Boolean) – Whether to use coordinates of the component’s container

  • halign ("center", "left", "right") – Determines the position of the component if it is narrower than the graphics context area (after scaling)

  • valign ("center", "top", "bottom") – Determiens the position of the component if it is shorter than the graphics context area (after scaling)

  • Description

  • -----------

  • container_coords is False (If) –

  • the (0 (then) –

  • coordinate of this (0)) –

  • context corresponds to the lower-left corner of the (graphics) –

  • outer_bounds. If container_coords is True (component's) –

  • then

  • method draws the component as it appears inside its container (the) –

:param : :param i.e.: :param it treats (0: :param 0) of the graphics context as the lower-left: :param corner of the container’s outer bounds.:

save(filename=None)

Save the graphics context to a file