I have to plot the 2D array (called para_beta) with dimensions (2779, 1334). These dimensions refer to the (time, height) that the measurements were taken.
When I plot using the code, the x axis and y axis ticks are just the count of the array dimensions, and don't reflect the time or height. I have lists of time_hour (len = 2779) and altitude (len = 1334) which give the actual time and height and need to be the x and y axis values. How do I do this?
#Importing variables (from netcdf file)
para_beta_raw = nc_file.variables['para_beta'][:] #Dim = time, height
para_beta = np.swapaxes(para_beta,0,1) # swap axes to put time on x axis
time_hour = time_bnds.tolist()
altitude = height_raw.tolist()
fig = plt.figure('Parallel')
ax1 = fig.add_subplot(111)
im = ax1.imshow(para_beta1, aspect = 'auto', cmap = 'jet', interpolation = 'none', origin = 'lowest')
cb = plt.colorbar(im, label = 'Parallel ATB [$m^{-1}\,sr^{-1}$]')
cb.set_clim([0.0001, 1.0])
ax1.set_xlabel('Time (Decimal hours)')
ax1.set_ylabel('Height (km)')
plt.show()
I have tried using extent
and using ax1.set_xticklabels(time_hour)
but these don't work. I included the resulting figure from the above code - if it was correct the x axis should extend to 24, and the y axis to 20.