nschloe / tikzplotlib

:bar_chart: Save matplotlib figures as TikZ/PGFplots for smooth integration into LaTeX.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

tikzplotlib.save("test.tex") creates empty file

vanKey2022 opened this issue · comments

Hello,

I have the problem, that the following code produces an empty tikz-file:

Might the reason be the polar plot itself?

`fig, ax = plt.subplots(subplot_kw={'projection': 'polar'})
ax.plot(theta, r1,label = 'MIC1')
ax.plot(theta, r2,label = 'MIC2')
ax.plot(theta, r3,label = 'MIC3')
ax.set_rmin(50)
ax.set_rmax(62)
major_ticks = np.arange(50, 62, 2)
minor_ticks = np.arange(50, 62, 1)
ax.set_rticks(major_ticks)
ax.set_rticks(minor_ticks, minor=True)
ax.grid(which='both')
ax.set_xticks(np.pi/180. * np.linspace(0, 360, 36, endpoint=False))
ax.set_rlabel_position(22.5)
ax.grid(True)
ax.legend(bbox_to_anchor=(1.3, 1), loc='upper right')
plt.show()

tikzplotlib.save("figure1.pgf")`

The content of test.tex will be:
`% This file was created with tikzplotlib v0.10.1.
\begin{tikzpicture}

\end{tikzpicture}
`

Can someone help me out here?
Kind regards

...it depends on the position of plt.show()
...but I have no clue how to get the tikz-polarplot anyway