Hi all,

I'm trying to make a contourf plot out of 3 2d fields, where one is seconds since 1970. This works! But my problem is the formatting of the xaxes. These I like to have in hh:mm. Since the time is a 2d field, a conversion to datetime didn't work.

The other way I tried was plotting a second axis with x as 1d datetime, y (1d) and z as before, removing the collections, plotting the original data and deleting the xticks and labels. But i didn't succeed with that. i get a year out of range error. Any help would be appreciated.

here is a small code peace that could help to understand what i like to do.

from matplotlib import pyplot, dates

import numpy as np

x = np.array([[1387029209.,1387029310.,1387029411.,1387029512.],

[1387029209.,1387029310.,1387029411.,1387029512.],

[1387029209.,1387029310.,1387029411.,1387029512.]])

y = np.array([[143., 143., 133., 143.],

[172., 162., 122., 172.],

[201., 241., 201., 201.]])

z = np.random.rand(3,4)

fig = pyplot.figure()

dnt = dates.num2date(dates.epoch2num(x[0]))

ax2 = fig.add_axes([0.1,0.1,0.8,0.8])

c = ax2.contour(dnt,y[:,0],z)

for coll in c.collections:

ax2.collections.remove(coll)

ax2.patch.set_alpha(0.0)

time_format = dates.DateFormatter('%H:%M')

ax2.xaxis.set_major_formatter(time_format)

ax1 = fig.add_axes([0.1,0.1,0.8,0.8])

ax1.contourf(x,y,z)

#ax1.tick_params(axis='x',which='both',bottom='off',top='off',labelbottom='off')

pyplot.show()

## ···

--

Dr. Mario Mech

Institute for Geophysics and Meteorology

University of Cologne

Pohligstr.3 / Room 3.120

50969 Cologne

Germany

t: +49(0)221-470-1776

f: +49(0)221-470-5198

e: mech@...2927...

w: http://www.uni-koeln.de/~mmech/