lovespeed
lovespeed

Reputation: 5045

Log x-scale in imshow :: matplotlib

I have a table which looks like this

enter image description here

I have the highlighted part as a matrix of which I want to do an imshow. I want to have the x-scale of the plot logarithmic, as one can understand by looking at the parameter values in the topmost row. How to do this is matplotlib?

Upvotes: 6

Views: 7960

Answers (1)

Paul H
Paul H

Reputation: 68156

You want to use pcolor, not imshow. Here's 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 give me:

log pcolor

Upvotes: 16

Related Questions