|
From: Arnaldo R. <arn...@gm...> - 2015-03-06 13:40:36
|
Hi, . Your example is not much clear. It's better post some short example and a running piece of code. btw, maybe your problem should be solved with this post: http://stackoverflow.com/questions/13784201/matplotlib-2-subplots-1-colorbar Cheers, Arnaldo --- *Arnaldo D'Amaral Pereira Granja Russo* Lab. de Estudos dos Oceanos e Clima Instituto de Oceanografia - FURG 2015-03-06 6:36 GMT-03:00 Dyah rahayu martiningrum <dya...@gm...>: > 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.... > > > > ------------------------------------------------------------------------------ > Dive into the World of Parallel Programming The Go Parallel Website, > sponsored > by Intel and developed in partnership with Slashdot Media, is your hub for > all > things parallel software development, from weekly thought leadership blogs > to > news, videos, case studies, tutorials and more. Take a look and join the > conversation now. http://goparallel.sourceforge.net/ > _______________________________________________ > Matplotlib-users mailing list > Mat...@li... > https://lists.sourceforge.net/lists/listinfo/matplotlib-users > > |