Is it possible to somehow have the values on the X-axis be printed in hexadecimal notation in matplotlib? For my plot the X-axis represents memory addresses.
Thanks.
You can set a Formatter on the axis, for example the FormatStrFormatter.
Simple example :
import matplotlib.pyplot as plt
import matplotlib.ticker as ticker
plt.plot([10, 20, 30], [1, 3, 2])
axes = plt.gca()
axes.get_xaxis().set_major_locator(ticker.MultipleLocator(1))
axes.get_xaxis().set_major_formatter(ticker.FormatStrFormatter("%x"))
plt.show()
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With