tikzplotlib
tikzplotlib copied to clipboard
Quirky rationale behind `tex_relative_path_to_data`
It seems like there might have been a change with the meaning behind this option, or I have forgotten how it is intended to work.
Say I have the following file-structure:
root
| - tikz_files
| - foobar.py
| - main.tex
I would like to use my code in foobar.py to create some heatmap-plots whose files are stored in tikz_files such that I can write \input{tikz_files/foobar.tex} in my file main.tex. I was under the impression that I have to modify tex_relative_path_to_data accordingly, but I do not seem to get it to work.
When I write something like
tlt.save("foobar.tex")
this works, but the paths in the TeX-files simply contain foobar-000.png. Hence, I use
tlt.save("foobar.tex",tex_relative_path_to_data="tikz_files")
since I expect this to tell latex that the data is actually in "tikz_files", but it seems like tlt is also using it to determine the path of the PNG-file, so I get
FileNotFoundError: [Errno 2] No such file or directory: 'tikz_files/foobar-000.png'
which makes kinda sense to me, but how is this intended to be used? If my file foobar.py is not in the same directory as main.tex, then this has no useful effect, I suppose.
I am pretty sure that I am wrong. Please, enlighten me.