Figures

class latexdocs.items.TikZFigure(*args, plot_options=None, **kwargs)[source]

A class to handle TikZ figures.

Parameters

plot_options (str, Optional) – Options to control the layout. See the examples. Default is ‘height=4cm, width=6cm, grid=major’.

Example

>>> from latexdocs import Document, TikZFigure
>>> doc = Document(title='Title', author='Author', date=True)
>>> fig = TikZFigure(plot_options='height=4cm, width=6cm, grid=major')
>>> fig.append(Plot(name='model', func='-x^5 - 242'))
>>> coordinates = [
>>>     (-4.77778, 2027.60977),
>>>     (-3.55556, 347.84069),
>>>     (-2.33333, 22.58953),
>>>     (-1.11111, -493.50066),
>>>     (0.11111, 46.66082),
>>>     (1.33333, -205.56286),
>>>     (2.55556, -341.40638),
>>>     (3.77778, -1169.24780),
>>>     (5.00000, -3269.56775),
>>> ]
>>> fig.append(Plot(name='estimate', coordinates=coordinates))
>>> doc['Section', 'Subsection'].append(fig)
class latexdocs.items.Image(*args, position=None, width=None, filename=None, caption=None, w=None, **kwargs)[source]

A class to embed images in your document.

Parameters
  • *args (tuple, Optional) – The first positional argument can be the full path to a file.

  • position (str, Optional) – Controls the position of the figure. Default is ‘H’.

  • w (width or) – The width of the image.

  • filename (str, Optional) – The full path of the file to read. The path must be provided either with this argument, or as the first position argument. Default is None.

  • caption (str, Optional) – The caption of the table.

Example

Assuming you have a file image.png on your local filesystem:

>>> from latexdocs import Document, Image
>>> doc = Document()
>>> img = Image("image.png", position='h!', width='350px')
classmethod from_plt(path, *args, **kwargs)[source]

Returns an instance from the currently active matplotlib figure.

Parameters

path (str) – The path where the file is to be stored.