From: Timothy Duly <timduly4@gm...>  20120613 20:01:04

Hello, I am trying to make a simple pcolor plot with a datetime on the xaxis. I am able to get a time label on the xaxis fine with a regular plot command, but it doesn't appear to work if you use pcolor. This simple example below shows that it does not work. Does anyone have any idea as to why a datetime can't go on a pcolor plot? What is the best approach is to solve the problem? Thanks, Tim import numpy as np import datetime import random import matplotlib import matplotlib.pyplot as plt # create some random data, one for a line plot, and another for pcolor: data1 = np.array ([random.random() for k in range(10)]) data2 = np.zeros((10,10)) for i in range(10): for j in range(10): data2[i,j] = random.random() # build datetimes (dts): dts = [] for k in range(10): dts.append(datetime.datetime(2012,1,1+k)) # First example, showing a regular plot with datetimes in the xaxis. fig = plt.figure(1) fig.clf() ax = fig.add_subplot(111) ax.plot(dts,data1) plt.show() # Second example, showing a pcolor with datetimes in the xaxis. # This plot does not work. fig = plt.figure(2) fig.clf() ax = fig.add_subplot(111) ax.pcolor(dts,np.arange(10),data2) plt.show() 