Showing a background image behind a plot_date line

Hi,

I’d like to show a background image after plotting dates. I use imshow, which works, but makes the plotted line erased.
If somebody can help, it would be valuable.
thanks in advance
jm

Here is the code. If the line “ax.imshow(img,alpha=0.5)” is commented out, the graph is correctly displayed.

-- coding: utf8 --

import datetime, csv
import matplotlib.pyplot as plt
from pylab import figure, show
from matplotlib import image
from matplotlib.dates import MONDAY, SATURDAY
from matplotlib.dates import DayLocator, MonthLocator, WeekdayLocator, DateFormatter

‘’’ data reading. Here is the data :
Nombre de signalements par jour du 01/08/2011 au 02/10/2011
20110801,8
20111002,10
‘’’
dates, data = [], []
dataReader = csv.reader(open(‘data.csv’, ‘rb’))
for i,row in enumerate(dataReader):
if i == 0:
title = row[0]
else:
w = row[0]
w = datetime.date(int(w[0:4]),int(w[4:6]),int(w[6:8])).toordinal()
dates += [w]
data += [row[1]]

···

days = DayLocator()
months = MonthLocator()
mondays = WeekdayLocator(MONDAY)
dateFmt = DateFormatter("%d/%m/%Y")
fig = figure()
img = image.imread(‘carte quartiers Creil.png’)
fig.set_facecolor(‘w’)
ax = fig.add_subplot(111)
ax.get_frame().set_alpha(0)
ax.plot_date(dates, data,’-’,color=‘r’,alpha=0.75,linewidth=2)
loc = months
if dates[-1] - dates[0] <= 10:
loc = days
ax.xaxis.set_major_locator(loc)
ax.xaxis.set_major_formatter(dateFmt)
ax.xaxis.set_minor_locator(mondays)
ax.grid(True)
plt.ylabel(‘nombre de signalements’)
plt.title(title)
fig.autofmt_xdate()
ax.imshow(img,alpha=0.5)
show()