Using pdf pages below results in a pdf without the plots.
Is it possible to resolve this for plots from pivot tables?
import seaborn as sns
titanic = sns.load_dataset('titanic')
import matplotlib.backends.backend_pdf
pdf = matplotlib.backends.backend_pdf.PdfPages("seaborn.pdf")
# Loop over list 's' for plots
with PdfPages(r'seaborn.pdf') as export_pdf:
s = ['embark_town', 'class', 'embarked']
for i in s:
fig = plt.figure(figsize = [10, 5]);
ax = titanic.pivot_table(values='fare', columns = i, index='sex', aggfunc='sum').plot()
export_pdf.savefig(fig, bbox_inches='tight')