Log x-scale in imshow :: matplotlib

I have a table that looks like this:

enter image description here

I have a dedicated part, the matrix of which I want to do imshow. I want the x-scale of the logarithmic graph, as you can understand, by looking at the parameter values ​​in the very top line. How to do it - matplotlib?

+4
source share
1 answer

You want to use pcolor, not imshow. Here is an example:

import numpy as np
import matplotlib.pyplot as plt
fig, ax = plt.subplots()
Z = np.random.random(size=(7,7))
x = 10.0 ** np.arange(-2, 5)
y = 10.0 ** np.arange(-4, 3)
ax.set_yscale('log')
ax.set_xscale('log')
ax.pcolor(x, y, Z)

Which gives me:

log pcolor

+10
source

All Articles