I'd like to manipulate the ticks of every plot in my subplots. When plotting a single plot I get the desired result by using:
import matplotlib.pyplot as plt
import numpy as np
# ...
# some data acquisition
# ...
ax.imshow(data[i], cmap=plt.cm.jet, origin='bottom')
ax.contour(x, y, dataFitted[i].reshape(2*crop, 2*crop), 3, colors='white')
# adjust scale from pixel to micrometers on heat maps
pixelSize = 5.5 # micrometer/pxl
scaleEnd = crop * pixelSize
wishedTicks = np.array([-150, -100, -50, 0, 50, 100, 150])
originalTicks = (wishedTicks + scaleEnd) / pixelSize
plt.xticks(originalTicks, wishedTicks)
plt.yticks(originalTicks, wishedTicks)
So far, so good, but if I use
fig, ax = plt.subplots(nrows=5, ncols=4)
to create subplots, the function plt.xticks()
is not available any more to my understanding.
Is there a way to receive the same result by
- either globally (for all figures) manipulating the axis in the same way I did for a single plot
or
- manipulating each subplot individually in the desired way as above?