Open lucaventurini opened 7 years ago
Can you post the output tex too? Shouldn't be too large in this case.
Sure.
% This file was created by matplotlib2tikz v0.6.2.
\begin{tikzpicture}
\begin{axis}[
xmin=0, xmax=1,
ymin=0.635, ymax=0.665,
tick align=outside,
xmajorgrids,
x grid style={lightgray!92.026143790849673!black},
ymajorgrids,
y grid style={lightgray!92.026143790849673!black}
]
\end{axis}
\end{tikzpicture}
Alright, so that looks fairly normal.
What happens here is that default settings from matplotlib are translated into default settings in pgfplots. Those simply happen to differ.
Trying to imitate exactly what mpl looks like would probably make the output file a mess. (Think of legend border colors, fonts, etc.)
What you're looking for is the extra
argument to save()
, and you want to supply a pgfplots command for specifying the data precision. Not sure what that is right now, but you'll find it in the manual.
Seems fair.
Now let's say I add:
fig, ax = plt.subplots()
ax.yaxis.set_major_formatter(FormatStrFormatter('%.3f'))
to the plot above. Shouldn't be it translated to pgfplots? (it is not...)
Hm, yeah, the number formats aren't considered at all. Perhaps this can be fixed after all...
When exporting this simple plot:
the label on the y axis in the result are labeled to 2-digit precision. I'd expect a behavior similar to matplotlib, i.e. 3-digit precision.