I want to some data with a background image using matplotlib.
I found here that I need to use extent.
However, if the range of my data is not the same the plot scales as follows.
import numpy as np
import matplotlib.pyplot as plt
from scipy.misc import imread
fig = plt.figure(figsize=(8,8))
ax = plt.axes(xlim=(0,10),ylim=(0,1))
np.random.seed(0)
x = np.random.uniform(0.0,10.0,15)
y = np.random.uniform(0.0,1.0,15)
img = imread('lena.jpg')
ax.scatter(x,y,zorder=1)
ax.imshow(img, zorder=0, extent=[0.5, 8.0, 0.0, 1.0])
How can I keep the limits of my axes and avoid the scaling?
