FigureStar

class kgpy.latex.FigureStar(*, position=None, **kwargs)

Bases: Figure

Parameters:

position (str) –

__init__(*, position=None, **kwargs)
Parameters:

position (str) – Define the positioning of a floating environment, for instance 'h'. See the references for more information.

References

Attributes

begin_paragraph

Start a new paragraph before this environment.

content_separator

end_paragraph

Start a new paragraph after this environment.

escape

Determine whether or not to escape content of this class.

latex_name

Return the name of the class used in LaTeX.

omit_if_empty

Set to true if this full container should be equivalent to an empty string if it has no content.

packages

separate_paragraph

By default floats are positioned inside a separate paragraph.

Methods

__init__(*[, position])

type position:

typing.Optional[str]

add_caption(caption)

Add a caption to the float.

add_image(filename, *[, width, placement])

Add an image to the figure.

add_plot(*args[, extension])

Add the current Matplotlib plot to the figure.

append(item)

S.append(value) -- append value to the end of the sequence

clear()

copy()

count(value)

create(child)

Add a LaTeX object to current container, context-manager style.

dump(file_w)

Write the LaTeX representation of the class to a file.

dump_packages(file_w)

Write the LaTeX representation of the packages to a file.

dumps()

Represent the environment as a string in LaTeX syntax.

dumps_as_content()

Create a string representation of the object as content.

dumps_content(**kwargs)

Represent the container as a string in LaTeX syntax.

dumps_packages()

Represent the packages needed as a string in LaTeX syntax.

extend(other)

S.extend(iterable) -- extend sequence by appending elements from the iterable

generate_tex(filepath)

Generate a .tex file.

index(value, [start, [stop]])

Raises ValueError if the value is not present.

insert(i, item)

S.insert(index, value) -- insert value before index

pop([index])

Raise IndexError if list is empty or index is out of range.

remove(item)

S.remove(value) -- remove first occurrence of value.

reverse()

S.reverse() -- reverse IN PLACE

sort(*args, **kwds)

Inheritance Diagram

digraph inheritanceeeefd8dc90 { bgcolor=transparent; rankdir=TB; size="8.0, 12.0"; "collections.UserList" [URL="https://docs.python.org/3/library/collections.html#collections.UserList",fillcolor=white,fontname="Vera Sans, DejaVu Sans, Liberation Sans, Arial, Helvetica, sans",fontsize=10,height=0.25,shape=box,style="setlinewidth(0.5),filled",target="_top",tooltip="A more or less complete user-defined wrapper around list objects."]; "collections.abc.MutableSequence" -> "collections.UserList" [arrowsize=0.5,style="setlinewidth(0.5)"]; "collections.abc.Collection" [URL="https://docs.python.org/3/library/collections.abc.html#collections.abc.Collection",fillcolor=white,fontname="Vera Sans, DejaVu Sans, Liberation Sans, Arial, Helvetica, sans",fontsize=10,height=0.25,shape=box,style="setlinewidth(0.5),filled",target="_top"]; "collections.abc.Sized" -> "collections.abc.Collection" [arrowsize=0.5,style="setlinewidth(0.5)"]; "collections.abc.Iterable" -> "collections.abc.Collection" [arrowsize=0.5,style="setlinewidth(0.5)"]; "collections.abc.Container" -> "collections.abc.Collection" [arrowsize=0.5,style="setlinewidth(0.5)"]; "collections.abc.Container" [URL="https://docs.python.org/3/library/collections.abc.html#collections.abc.Container",fillcolor=white,fontname="Vera Sans, DejaVu Sans, Liberation Sans, Arial, Helvetica, sans",fontsize=10,height=0.25,shape=box,style="setlinewidth(0.5),filled",target="_top"]; "collections.abc.Iterable" [URL="https://docs.python.org/3/library/collections.abc.html#collections.abc.Iterable",fillcolor=white,fontname="Vera Sans, DejaVu Sans, Liberation Sans, Arial, Helvetica, sans",fontsize=10,height=0.25,shape=box,style="setlinewidth(0.5),filled",target="_top"]; "collections.abc.MutableSequence" [URL="https://docs.python.org/3/library/collections.abc.html#collections.abc.MutableSequence",fillcolor=white,fontname="Vera Sans, DejaVu Sans, Liberation Sans, Arial, Helvetica, sans",fontsize=10,height=0.25,shape=box,style="setlinewidth(0.5),filled",target="_top"]; "collections.abc.Sequence" -> "collections.abc.MutableSequence" [arrowsize=0.5,style="setlinewidth(0.5)"]; "collections.abc.Reversible" [URL="https://docs.python.org/3/library/collections.abc.html#collections.abc.Reversible",fillcolor=white,fontname="Vera Sans, DejaVu Sans, Liberation Sans, Arial, Helvetica, sans",fontsize=10,height=0.25,shape=box,style="setlinewidth(0.5),filled",target="_top"]; "collections.abc.Iterable" -> "collections.abc.Reversible" [arrowsize=0.5,style="setlinewidth(0.5)"]; "collections.abc.Sequence" [URL="https://docs.python.org/3/library/collections.abc.html#collections.abc.Sequence",fillcolor=white,fontname="Vera Sans, DejaVu Sans, Liberation Sans, Arial, Helvetica, sans",fontsize=10,height=0.25,shape=box,style="setlinewidth(0.5),filled",target="_top",tooltip="All the operations on a read-only sequence."]; "collections.abc.Reversible" -> "collections.abc.Sequence" [arrowsize=0.5,style="setlinewidth(0.5)"]; "collections.abc.Collection" -> "collections.abc.Sequence" [arrowsize=0.5,style="setlinewidth(0.5)"]; "collections.abc.Sized" [URL="https://docs.python.org/3/library/collections.abc.html#collections.abc.Sized",fillcolor=white,fontname="Vera Sans, DejaVu Sans, Liberation Sans, Arial, Helvetica, sans",fontsize=10,height=0.25,shape=box,style="setlinewidth(0.5),filled",target="_top"]; "kgpy.latex.FigureStar" [URL="kgpy.latex.FigureStar.html#kgpy.latex.FigureStar",fillcolor=white,fontname="Vera Sans, DejaVu Sans, Liberation Sans, Arial, Helvetica, sans",fontsize=10,height=0.25,shape=box,style="setlinewidth(0.5),filled",target="_top"]; "pylatex.figure.Figure" -> "kgpy.latex.FigureStar" [arrowsize=0.5,style="setlinewidth(0.5)"]; "pylatex.base_classes.containers.Container" [fillcolor=white,fontname="Vera Sans, DejaVu Sans, Liberation Sans, Arial, Helvetica, sans",fontsize=10,height=0.25,shape=box,style="setlinewidth(0.5),filled",tooltip="A base class that groups multiple LaTeX classes."]; "pylatex.base_classes.latex_object.LatexObject" -> "pylatex.base_classes.containers.Container" [arrowsize=0.5,style="setlinewidth(0.5)"]; "collections.UserList" -> "pylatex.base_classes.containers.Container" [arrowsize=0.5,style="setlinewidth(0.5)"]; "pylatex.base_classes.containers.Environment" [fillcolor=white,fontname="Vera Sans, DejaVu Sans, Liberation Sans, Arial, Helvetica, sans",fontsize=10,height=0.25,shape=box,style="setlinewidth(0.5),filled",tooltip="A base class for LaTeX environments."]; "pylatex.base_classes.containers.Container" -> "pylatex.base_classes.containers.Environment" [arrowsize=0.5,style="setlinewidth(0.5)"]; "pylatex.base_classes.float.Float" [fillcolor=white,fontname="Vera Sans, DejaVu Sans, Liberation Sans, Arial, Helvetica, sans",fontsize=10,height=0.25,shape=box,style="setlinewidth(0.5),filled",tooltip="A class that represents a floating environment."]; "pylatex.base_classes.containers.Environment" -> "pylatex.base_classes.float.Float" [arrowsize=0.5,style="setlinewidth(0.5)"]; "pylatex.base_classes.latex_object.LatexObject" [fillcolor=white,fontname="Vera Sans, DejaVu Sans, Liberation Sans, Arial, Helvetica, sans",fontsize=10,height=0.25,shape=box,style="setlinewidth(0.5),filled",tooltip="The class that every other LaTeX class is a subclass of."]; "pylatex.figure.Figure" [fillcolor=white,fontname="Vera Sans, DejaVu Sans, Liberation Sans, Arial, Helvetica, sans",fontsize=10,height=0.25,shape=box,style="setlinewidth(0.5),filled",tooltip="A class that represents a Figure environment."]; "pylatex.base_classes.float.Float" -> "pylatex.figure.Figure" [arrowsize=0.5,style="setlinewidth(0.5)"]; }
add_caption(caption)

Add a caption to the float.

Parameters:

caption (str) – The text of the caption.

add_image(filename, *, width=NoEscape(0.8\textwidth), placement=NoEscape(\centering))

Add an image to the figure.

Parameters:
  • filename (str) – Filename of the image.

  • width (str) – The width of the image

  • placement (str) – Placement of the figure, None is also accepted.

add_plot(*args, extension='pdf', **kwargs)

Add the current Matplotlib plot to the figure.

The plot that gets added is the one that would normally be shown when using plt.show().

Parameters:
  • args – Arguments passed to plt.savefig for displaying the plot.

  • extension (str) – extension of image file indicating figure file type

  • kwargs – Keyword arguments passed to plt.savefig for displaying the plot. In case these contain width or placement, they will be used for the same purpose as in the add_image command. Namely the width and placement of the generated plot in the LaTeX document.

append(item)

S.append(value) – append value to the end of the sequence

clear() None -- remove all items from S
copy()
count(value) integer -- return number of occurrences of value
create(child)

Add a LaTeX object to current container, context-manager style.

Parameters:

child (~.Container) – An object to be added to the current container

dump(file_w)

Write the LaTeX representation of the class to a file.

Parameters:

file_w (io.TextIOBase) – The file object in which to save the data

dump_packages(file_w)

Write the LaTeX representation of the packages to a file.

Parameters:

file_w (io.TextIOBase) – The file object in which to save the data

dumps()

Represent the environment as a string in LaTeX syntax.

Returns:

A LaTeX string representing the environment.

Return type:

str

dumps_as_content()

Create a string representation of the object as content.

This is currently only used to add new lines before and after the output of the dumps function. These can be added or removed by changing the begin_paragraph, end_paragraph and separate_paragraph attributes of the class.

dumps_content(**kwargs)

Represent the container as a string in LaTeX syntax.

Parameters:

**kwargs – Arguments that can be passed to ~.dumps_list

Returns:

A LaTeX string representing the container

Return type:

string

dumps_packages()

Represent the packages needed as a string in LaTeX syntax.

Returns:

A LaTeX string representing the packages of the container

Return type:

string

extend(other)

S.extend(iterable) – extend sequence by appending elements from the iterable

generate_tex(filepath)

Generate a .tex file.

Parameters:

filepath (str) – The name of the file (without .tex)

index(value[, start[, stop]]) integer -- return first index of value.

Raises ValueError if the value is not present.

Supporting start and stop arguments is optional, but recommended.

insert(i, item)

S.insert(index, value) – insert value before index

pop([index]) item -- remove and return item at index (default last).

Raise IndexError if list is empty or index is out of range.

remove(item)

S.remove(value) – remove first occurrence of value. Raise ValueError if the value is not present.

reverse()

S.reverse() – reverse IN PLACE

sort(*args, **kwds)
begin_paragraph = False

Start a new paragraph before this environment.

content_separator = '%\n'
end_paragraph = False

Start a new paragraph after this environment.

property escape

Determine whether or not to escape content of this class.

This defaults to True for most classes.

property latex_name

Return the name of the class used in LaTeX.

It can be None when the class doesn’t have a name.

omit_if_empty = False

Set to true if this full container should be equivalent to an empty string if it has no content.

packages = OrderedSet()
separate_paragraph = True

By default floats are positioned inside a separate paragraph. Setting this to option to False will change that.