I am plotting a heatmap using matplotlib.pyplot.pcolor().
def gen_heatmap_stadtbahn():
x_axis, y_axis, dist_data, lowest, highest = load_data_stadtbahn()
# Plotting Heatmap
plt.pcolor(x_axis, y_axis, dist_data, norm = colors.SymLogNorm(linthresh = 0.3, vmin = lowest, vmax = highest), cmap = "plasma_r", shading = "auto")
plt.show()
Now I would like export the raw image without the axes around them:
plt.imsave("heatmap.png", dist_data, cmap = "plasma_r")
You can save a plot as a raw image quite easily using pyplot.imsave() but unfortunately that does not seem to provide an option to apply Symmetric Log Normalization to the data but can only visualize the data linearly.
Documentation: https://matplotlib.org/3.1.1/api/_as_gen/matplotlib.pyplot.imsave.html
Is there a way to force matplotlib to use SymLogNorm and if not is there an easy way to have numpys perform this operation on the data? I unfortunately could only find examples of a logarithmic scale which can not handle negative numbers.

