Figure¶
-
class
texfigure.
Figure
(file_name, reference=None)[source]¶ Bases:
object
A class for holding a figure file, that knows how to represent itself as a latex environment.
Parameters: file_name :
str
The full path of the figure file.
reference :
str
A reference label for this figure, used as default values for caption and label.
Examples
\begin{pycode} import matplotlib.pyplot as plt fig = plt.figure() plt.plot([1,2], [3,4], 'o') myfig = texfigure.Figure(fig, 'myfig') \end{pycode} \py|myfig|
Attributes
fname ( str
) The base name of the full file pathbase_dir ( str
) The directory containing the figure filecaption ( str
) The caption to use when representing the figure. (DefaultFigure reference
)label ( str
) The latex label assigned to the figure envrionment, will bre prefixed with'fig
. (Defaultfig:reference
)placement ( str
) The figure envrionment placement value. (Defaulth
)figure_env_name ( str
) The string used for the figure environment i.e.\begin{figure}
. Useful for changing tofigure*
etc. (Defaultfigure
)figure_width ( str
) The latex figure width, not used for pgf files. (Default0.95\columnwidth
)subfig_width ( str
) LaTeX figure width for when the figure is included in a subfigure. (Default0.45\columnwidth
)subfig_placement ( str
) The subfigure environment placement. (Defaultb
)extension_mapping ( dict
) A mapping of file extensions to methods to return LaTeX includes for the file type.fig_str ( str
) The LaTeX template for representing thisFigure
as a figure environment.subfig_str ( str
) The LaTeX template for representing thisFigure
as a subfigure.Attributes Summary
extension
File extension of fname. fig_str
subfig_str
Methods Summary
get_pgf_include
()Return the import statement for this Figure
as a pgf file.close.get_standard_include
()Return the includegraphics command for most other file types. repr_figure
()Return a string LaTeX figure environment for this Figure
repr_subfigure
()Return a string subfigure environment for this Figure
Attributes Documentation
-
extension
¶ File extension of fname.
-
fig_str
= '\n\\begin{{{figure_env_name}}}[{placement}]\n \\centering\n {myfig}\n \\caption{{{caption}}}\n \\label{{{label}}}\n\\end{{{figure_env_name}}}\n'¶
-
subfig_str
= '\n \\begin{{subfigure}}[{placement}]{{{width}}}\n {myfig}\n \\caption{{{caption}}}\n \\label{{{label}}}\n \\end{{subfigure}}'¶
Methods Documentation
-