artisticat1 / obsidian-tikzjax

Render LaTeX and TikZ diagrams in your notes
MIT License
357 stars 18 forks source link

[Question] Plotting images with external data files using pdfplot #13

Open Huary007 opened 1 year ago

Huary007 commented 1 year ago

Thank you very much for creating this plugin. Inserting TikZ images in obsidian has improved my work efficiency.

I recently ran into some problems when trying to draw an image using external data files.

  1. When I use relative paths, I don't know which folder I should put my data files in.
  2. When I use absolute paths the images don't display properly either.

I use the data on this page as an example. This example can also be viewed in this overleaf page.

I put mesh.txt file in my obsidian folder, and use the following code in obsidian.

\documentclass[border= 5mm]{standalone}
\usepackage{pgfplots}
\pgfplotsset{compat=1.14}
\begin{document}
\begin{tikzpicture}
\begin{axis}[grid=both,view={70}{40},colormap/viridis]
  \addplot3+[surf,mesh/rows=11,mesh/ordering=colwise,no marks] file {mesh.txt};
\end{axis}
\end{tikzpicture}
\end{document} 

As shown in the picture below, the mesh image is not displayed properly in reading mode.

pdfplot_in_obsidian

artisticat1 commented 1 year ago

Hello! At the moment, it isn't possible to load external data files into TikZJax.

However, I believe it should be possible to modify TikZJax and allow users to load in their own data files. I don't have any plans to do this at the moment, but others are welcome to try having a go at it!

MohammadRazzaghpour commented 1 year ago

I have the same issue. And it is very important to me.