tikz
fdpyutils.tikz.matshow.TikzMatrix
Class to visualize a matrix with TikZ.
Attributes:
-
TEMPLATE
(str
) –Template TikZ code containing placeholders that will be substituted with content when saving a figure.
Examples:
>>> from numpy import linspace
>>> mat = linspace(0, 1, num=9).reshape(3, 3)
>>> savepath = "mat.tex"
>>> # NOTE to compile, you need `pdflatex`
>>> TikzMatrix(mat).save(savepath, compile=False)
Store the matrix internally.
Parameters:
-
mat
(Union[Tensor, ndarray]
) –The matrix that will be visualized as PyTorch tensor or NumPy array.
Raises:
-
ValueError
–If the supplied array is not 2d.
Source code in fdpyutils/tikz/matshow.py
save
Save the matrix plot as standalone TikZ figure and maybe build to pdf.
Parameters:
-
savepath
(str
) –Path to save the figure to (including
'.tex'
). -
compile
(bool
, default:False
) –Whether to compile the TikZ figure to pdf. Default is
False
.