nschloe / tikzplotlib

:bar_chart: Save matplotlib figures as TikZ/PGFplots for smooth integration into LaTeX.
MIT License
2.4k stars 214 forks source link

Subplots are messed up #155

Open DavidNemeskey opened 7 years ago

DavidNemeskey commented 7 years ago

I tried to convert a plot with 4x2 subplots into tikz, but the output is not very faithful to what I see with plt.show(). I attached both the image generated by matplotlib and the pdf file generated by xelatex. It does nothing but import the figure.

The problems:

This is what it should look like: plt_show This is what it looks like: xelatex.pdf Without subplots_adjust: test.tikz.txt With subplots_adjust: test_adjust.tikz.txt The Python file: plotit.py.txt

mladenivkovic commented 6 years ago

For the overlapping axes, a quick workaround is to add vertical sep=2cm [or some other value] to the line beginning with \begin{groupplot}. In your specific case, replace \begin{groupplot}[group style={group size=2 by 4}] with \begin{groupplot}[group style={group size=2 by 4, vertical sep=2cm}].