Dyah rahayu martiningrum
2015-03-06 09:36:44 UTC
Hello all,
I make multi plot with colorbars. I need help, how do make only one
colorbar for six panels? I also want to show only lowest x-axis. I copy my
recent code and figure here.
# Open file
fd = nc.Dataset(fname, 'r')
# Read variables
beam = fd.variables['beam'][:]
rng = fd.variables['range'][:]
tim = fd.variables['time'][:]
pwr = fd.variables['pwr'][:]
nfft = fd.variables['nfft'][0]
pn = fd.variables['pnoise'][:]
width=fd.variables['width'][:]
# Close netCDF file
fd.close()
# Specify beam
ibeam = ibeams[i]
# Time convertion
tim = tim/3600.0
#Plot
p_plot = pwr[ibeam]
for it in range(len(tim)):
p_plot[it] = p_plot[it] - pn[ibeam][it] - 10.*np.log10(nfft)
p_plot = p_plot.transpose()
#Specify subplot
pl.subplot(611 + i)
#Contour plot
v= np.linspace(5., 50., 5., endpoint=True)
x= pl.contourf(tim, rng, p_plot, v, cmap=pl.cm.jet)
x = pl.colorbar(ticks=v)
x.ax.set_title('dB')
print x
# Set X and Y axis lower/uppser limit
set_xy = range(4)
set_xy[0] = 18.0 # x min
set_xy[1] = 30.0 # x max
set_xy[2] = 200.0 # y min
set_xy[3] = 550.0 # y max
pl.axis(set_xy)
# Set labels
pl.xlabel('time (hours)')
pl.ylabel('range (km)')
pl.show()
Thank you....
I make multi plot with colorbars. I need help, how do make only one
colorbar for six panels? I also want to show only lowest x-axis. I copy my
recent code and figure here.
# Open file
fd = nc.Dataset(fname, 'r')
# Read variables
beam = fd.variables['beam'][:]
rng = fd.variables['range'][:]
tim = fd.variables['time'][:]
pwr = fd.variables['pwr'][:]
nfft = fd.variables['nfft'][0]
pn = fd.variables['pnoise'][:]
width=fd.variables['width'][:]
# Close netCDF file
fd.close()
# Specify beam
ibeam = ibeams[i]
# Time convertion
tim = tim/3600.0
#Plot
p_plot = pwr[ibeam]
for it in range(len(tim)):
p_plot[it] = p_plot[it] - pn[ibeam][it] - 10.*np.log10(nfft)
p_plot = p_plot.transpose()
#Specify subplot
pl.subplot(611 + i)
#Contour plot
v= np.linspace(5., 50., 5., endpoint=True)
x= pl.contourf(tim, rng, p_plot, v, cmap=pl.cm.jet)
x = pl.colorbar(ticks=v)
x.ax.set_title('dB')
print x
# Set X and Y axis lower/uppser limit
set_xy = range(4)
set_xy[0] = 18.0 # x min
set_xy[1] = 30.0 # x max
set_xy[2] = 200.0 # y min
set_xy[3] = 550.0 # y max
pl.axis(set_xy)
# Set labels
pl.xlabel('time (hours)')
pl.ylabel('range (km)')
pl.show()
Thank you....