Ich versuche, eine Farbleiste auf meiner Matpllotlib Konturf Plots anzupassen. Während ich wissenschaftliche Notation verwenden kann, versuche ich, die Basis der Notation zu ändern - im Wesentlichen so, dass meine Ticks im Bereich von (-100,100) statt (-10,10) liegen.Python matplotlib colorbar wissenschaftliche Notation Basis
Zum Beispiel ergibt sich eine einfache Handlung ...
import numpy as np
import matplotlib.pyplot as plt
z = (np.random.random((10,10)) - 0.5) * 0.2
fig, ax = plt.subplots()
plot = ax.contourf(z)
cbar = fig.colorbar(plot)
cbar.formatter.set_powerlimits((0, 0))
cbar.update_ticks()
plt.show()
wie so:
Allerdings habe ich das Etikett über dem colorbar sein möchte 1e-2 und die Zahlen reichen von -10 bis 10.
Wie würde ich darüber gehen?