Using matplotlib.pyplot
I want to plot my data relative to a certain set of axes but then I want to have my axis show a different range of values without affecting the portion of my data that is shown.
To be specific, I have a 1000x1000 grid of data I am plotting with pyplot.imshow()
; however, I only want my axes to run from -2 to 2 (both x and y axes) while still showing the whole 1000x1000 grid. If possible, I would like to hard code these values (-2 and 2) as being the limits of my axis rather than using some sort of rescaling from the 1000x1000 grid to the new axes.
Here is my code:
import numpy as np
import matplotlib.pyplot as plt
from matplotlib import cm
array = np.loadtxt("output.dat",unpack=True)
im = plt.imshow(array,cmap='hot')
plt.colorbar(im)