Here is an example. The next is what get's stored as a .png and this is how it displays on the screen and it is correct
and the next is the .svg which is using interpolation for the heatmap
They are both stored using the next line of code respectively
plt.savefig(filename,format='png')
plt.savefig(filename,format='svg')
And the next is the code that generates the actual plot
def heatmapText(data,xlabels=[],ylabels=[],cmap='jet',fontsize=7):
'''
Heatmap with text on each of the cells
'''
plt.imshow(data,interpolation='none',cmap=cmap)
for y in range(data.shape[0]):
for x in range(data.shape[1]):
plt.text(x , y , '%.1f' % data[y, x],
horizontalalignment='center',
verticalalignment='center',
fontsize=fontsize
)
plt.gca()
if ylabels!=[]:
plt.yticks(range(ylabels.size),ylabels.tolist(),rotation='horizontal')
if xlabels!=[]:
plt.xticks(range(xlabels.size),xlabels.tolist(),rotation='vertical')
For both plots I used exactly the same function but stored it in different formats. Last, in screen appears correctly (like in the .png).
Any ideas on how to have the .svg to store the file correctly?