I have the following Python script using Matplotlib and the ternary library. It generates a ternary plot with some labels on the vertices and axes:
import matplotlib.pyplot as plt
import ternary
# Cleaning up
plt.close('all')
# Open figure
scale = 100
fig, tax = ternary.figure(scale=scale)
tax.ticks(axis='lbr', multiple=10, linewidth=1, offset=0.025)
tax.get_axes().axis('off')
tax.clear_matplotlib_ticks()
# Draw Boundary and Gridlines
tax.boundary(linewidth=2.0)
tax.gridlines(color="grey", multiple=10)
# Vertex labels
tax.left_corner_label('A')
tax.right_corner_label('B')
tax.top_corner_label('C')
# Axis labels
tax.left_axis_label("$\longleftarrow$ A [%]", va='center', ha='center', offset=0.15)
tax.bottom_axis_label("B [%] $\longrightarrow$", va='center', ha='center', offset=0.11)
tax.right_axis_label("$\longleftarrow$ C [%]", va='center', ha='center', offset=0.15)
# Save figure
fig.savefig('ternary_plot_1.png')
fig.savefig('ternary_plot_2.png')
I call the savefig command twice directly after each other, and the resulting images look as those below. Notably the first does not show the labels on vertices and axis, while the second does. Why is that?
It behaves the same when saving as .eps or .svg. I have never seen this behavior with 'normal' plots. I suspect it has something to do with the way these labels are implemented in the ternary libary, but why would savefig behave differently when called a second time?