[Matplotlib-users] Plotting dates on the y-axis of a contour map/ hovmoller

vaultron94 sbuechele at albany.edu
Mon Jul 10 15:26:58 EDT 2017


Hello all,

So I ran into a snare when making a Hovmoller for a case study. I have
everything done and colors picked out. But for the life of me cannot find a
way to get the Y-axis to plot the dates provided in the data. Here is the
script I have.

import numpy as np
import datetime
import matplotlib.pyplot as plt
import os
import pandas as pd

def cmap(cmap):
    cmap = plt.cm.get_cmap(cmap)

data = pd.read_excel('/Users/operator/Documents/Hovmoller_dewpt.xlsx')

a=np.array(data)

time= (a[:,0])
lat= (a[:,1])
lon= (a[:,2])
BATA= (a[:,3])
BSPA= (a[:,4])
BUFF= (a[:,5])
CLIF= (a[:,6])
FAYE= (a[:,7])
HERK= (a[:,8])
JOHN= (a[:,9])
JORD= (a[:,10])
OPPE= (a[:,11])
WEST= (a[:,12])
timeZ= (a[:,13])


b=np.vstack((BUFF,BATA,CLIF,JORD,FAYE,WEST,HERK,OPPE,JOHN,BSPA)).T

plt.contourf(b, np.arange(40,67), cmap=('jet'))


plt.xlabel('BUFF  BATA  CLIF  JORD  FAYE  WEST  HERK  OPPE  JOHN  BSPA')
plt.ylabel('Time')
plt.grid('off')
plt.colorbar()

plt.title('Dewpoint Hovmoller for Mesonet Sites')
plt.figure()

#timeZ contains the dates I want, and instead of having the number of rows
as the y axis I want the dates there instead. Attached is the graphic I get
as of now. Any thoughts or advice is much appreciated!

Thank you

<http://matplotlib.1069221.n5.nabble.com/file/n48081/DewPoint.png> 



--
View this message in context: http://matplotlib.1069221.n5.nabble.com/Plotting-dates-on-the-y-axis-of-a-contour-map-hovmoller-tp48081.html
Sent from the matplotlib - users mailing list archive at Nabble.com.


More information about the Matplotlib-users mailing list