To define the axes for just one subplot colorabar
1 回表示 (過去 30 日間)
古いコメントを表示
*For subplot(1,7,5)- I want to define the range of colorabar [0 6]*
subplot(1,7,4)
m_proj('Stereographic','lat',90,'long',300,'radius',35,'rect','on');
m_contourf(long,lat,oct_skw_anom ,'linestyle','none');
m_grid('linewi',1,'tickdir','out',...
'xtick',6,'ytick',[72 76 80 84 88 90]);
m_coast('patch',[.6 .6 .6],'edgecolor','k');
m_elev('contour',[ ],'edgecolor',' ');
colorbar( 'location','southoutside');
subplot(1,7,5)
m_proj('Stereographic','lat',90,'long',300,'radius',35,'rect','on');
m_contourf(long,lat,oct_kts_anom ,'linestyle','none');
m_grid('linewi',1,'tickdir','out',...
'xtick',6,'ytick',[72 76 80 84 88 90]);
m_coast('patch',[.6 .6 .6],'edgecolor','k');
m_elev('contour',[ ],'edgecolor',' ');
caxis = ([0, 6]);
h = colorbar(caxis, 'southoutside');
1 件のコメント
Muhammad Usman Saleem
2016 年 4 月 13 日
there is an error
Undefined function 'm_proj' for input arguments of type 'char'.
in this line
m_proj('Stereographic','lat',90,'long',300,'radius',35,'rect','on');
採用された回答
Mike Garrity
2016 年 4 月 13 日
There are two different things you could mean here.
One is that you want the colormap to start where the data = 0 and end where the data = 6. You actually do that with the axes object, not the colorbar. The colorbar is just showing the mapping that the axes is using.
The subplot command returns a handle to the axes. So you'd want to do something like this:
ax = subplot(1,7,5)
m_proj('Stereographic','lat',90,'long',300,'radius',35,'rect','on');
m_contourf(long,lat,oct_kts_anom ,'linestyle','none');
m_grid('linewi',1,'tickdir','out',...
'xtick',6,'ytick',[72 76 80 84 88 90]);
m_coast('patch',[.6 .6 .6],'edgecolor','k');
m_elev('contour',[ ],'edgecolor',' ');
caxis(ax,[0 6])
colorbar('southoutside')
Note, you had a variable named caxis, that's also the name of the function you use to set the color range on the axes, so you might get a conflict there. You probably want to rename that variable and clear it from your workspace.
The other thing you might mean here is that you only want the colorbar to show a portion of the color range. This won't change the mapping between data values and colors. It's just like "zooming in" on the colorbar. The details of how you do this has changed a bit in the last couple of versions of MATLAB, but in R2016a, you would do this:
c = colorbar('southoutside');
c.Limits = [0 6];
or this:
colorbar('southoutside','Limits',[0 6])
6 件のコメント
Muhammad Usman Saleem
2016 年 4 月 14 日
I got confuse, whether this simile is for me or for some other comments? =D
その他の回答 (1 件)
Muhammad Usman Saleem
2016 年 4 月 13 日
編集済み: Muhammad Usman Saleem
2016 年 4 月 13 日
For setting range of your own desire, try this please
caxis([0, 6])
>> colorbar
Usman
参考
カテゴリ
Help Center および File Exchange で Colormaps についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!