axis values not showing when using .save()
alexgunsberg opened this issue · 2 comments
alexgunsberg commented
sns.lineplot(data = c_t_pop30, x="year", y="dif_growth")
plt.axvline(1949)
plt.axvline(1990)
tikzplotlib.save(r"/Users/a/Library/Mobile Documents/com~apple~CloudDocs/Courses/Economics/problem_set/manuscript/src/figs/fig4c_alone.tex")
Python shows the values for both axes, as expected
Here is the latex code that was saved:
% This file was created with tikzplotlib v0.10.1.
\begin{tikzpicture}
\definecolor{darkslategray38}{RGB}{38,38,38}
\definecolor{lavender234234242}{RGB}{234,234,242}
\definecolor{steelblue31119180}{RGB}{31,119,180}
\begin{axis}[
axis background/.style={fill=lavender234234242},
axis line style={white},
tick align=outside,
x grid style={white},
xlabel=\textcolor{darkslategray38}{year},
xmajorgrids,
xmajorticks=false,
xmin=1921.15, xmax=2005.85,
xtick style={color=darkslategray38},
y grid style={white},
ylabel=\textcolor{darkslategray38}{dif\_growth},
ymajorgrids,
ymajorticks=false,
ymin=-0.118489124518529, ymax=0.0844196238924438,
ytick style={color=darkslategray38}
]
\addplot [semithick, steelblue31119180]
table {%
1925 -0.0213444461404777
1933 -0.0566859111009346
1939 0.0751964989646723
1950 0.0192261391483122
1960 -0.109265999590757
1970 -0.0633964941647206
1980 -0.0537741982727188
1988 -0.00858158243166562
1992 -0.000585163199995131
2002 0.00798771051790126
};
\addplot [semithick, steelblue31119180]
table {%
1949 -0.118489124518529
1949 0.0844196238924437
};
\addplot [semithick, steelblue31119180]
table {%
1990 -0.118489124518529
1990 0.0844196238924437
};
\end{axis}
\end{tikzpicture}
alexgunsberg commented
Apparently this bug is only present with some matplotlib styles. I was using Seaborn the default didn't show the axises, but when I changed the style to ggplot it solved this part of the issue:
# setting plot style
import matplotlib as mpl
plt.close()
mpl.rcParams.update(mpl.rcParamsDefault)
plt.style.use("ggplot")
DoctorDinosaur commented
Same issue here, it's not working nice with seaborn. I'm just manually updating the generated code.