13 - matlab m_map地学绘图工具基础函数 - 介绍创建管理颜色映射的函数m_colmap和轮廓图绘制颜色条的函数m_contfbar

13 - matlab m_map地学绘图工具基础函数 - 介绍创建管理颜色映射的函数m_colmap和轮廓图绘制颜色条的函数m_contfbar

  • 0. 引言
  • 1. 关于m_colmap
  • 2. 关于m_contfbar
  • 3. 结语


0. 引言

   本篇介绍下m_map用于创建和管理颜色映射函数(m_colmap)和 为轮廓图绘制颜色条的函数(m_contfbar)。

1. 关于m_colmap

  m_colmap函数用于创建和管理颜色映射(colormap)。颜色映射可以用来对数据进行可视化编码,例如在地图上显示温度、高度、速度等信息。

m_colmap函数的一般形式如下:

cols=m_colmap(nme,m,ncol)
% m_colmap  Useful colormaps
%   m_colmap(NAME) returns an M-by-3 matrix containing the NAME colormap
%   where NAME is one of:
%     'jet' : a perceptually uniform variation of the JET colormap. It
%             contains the multiple colours which make JET useful, while
%             avoiding the weird highlighting especially around yellow and
%             cyan. The colors begin with dark blue, range through shades
%             of blue, green, orange and red, and ends with dark red.
%     'mBOD' : a modified blue/orange diverging colormap without white,
%              useful as a colorblind-friendly jet alternative
%
%     'diverging' : a blue/red diverging colormap
%     'BOD' : a blue/orange diverging colormap
%     'rBOD' : a different blue/orange colormap with gray in the middle
%
%     'odv'  : an isoluminant map 
%     'cyclic2': a cyclic colormap (for angles) with two dark regions
%     'cyclic1': a cyclic colormap (for angles) with one dark region
%
%     'land' : a topographic height (green-brown-white) shading
%     'water' : blue shading for water (goes with 'land').
%     'gland' : a topographic height  shading with more green
%     'bland' : a topographic height shading with browns only.
%
%     'blue' : a perceptually useful blue shading (good for bathymetry)
%     'green' : a perceptually useful green shading
%     'chlorophyll': Enhanced green for chlorophyll (to red)
%     'CBchlorophyll': Enhanced green for chlorophyll (to magenta)
%                               <-colorblind friendly
%
%     'EK80' : a standard echo-sounder map.
%     'chart':  the standard chart colour (single color)
%
%   and M is the same length as the current figure's colormap. If no
%   figure exists, the length of the default colormap is used. The
%   length can be explicitly specified with s_colmap(NAME,M).
%
%   m_colmap('demo') demonstrates the colormaps.
%
%   m_colmap(NAME,'step') returns a 256-color map in which colours are
%   perceptually bunched into 16 separate colours. This is useful
%   if you want to see "edges" in what would be an otherwise
%   smooth gradation (i.e. approaching the look of contouring).
%
%   m_colmap(NAME,'demo') Gives a demo of this behavior
%
%   m_colmap(NAME,'step',M) bunches into M colours.

  其中,nme 选择一种颜色类型;m 颜色长度,不设置就自动用默认的,设置了就颜色条按区间进行分段;

  m_map所有颜色类型可以通过下面一句代码查看:

m_colmap demo

m_colmap函数的使用示例,示例数据可以从网盘获取,提取码:ofxi:

%% m_colormap
clc;clear;
ncFilePath = 'GLDAS_NOAH10_M.A200602.021.nc4';
lon = ncread(ncFilePath,'lon');
lat = ncread(ncFilePath,'lat');    
soilmoi_data = ncread(ncFilePath,'SoilMoi0_10cm_inst'); [LN,LT]=meshgrid(lon,lat);m_proj('mercator','long',[69.5 105.5],'lat',[24.5 40.5]);
% 在地图上绘制伪彩色图
m_pcolor(LN,LT, soilmoi_data');colormap( m_colmap('jet') );
%colormap( m_colmap('jet',10) );% 添加地图边界、标签和色标
m_gshhs('ic','color',[.5 .5 .5]) % 中等分辨率海岸线
m_gshhs('ir2','color','k')   % 中等分辨率河流
m_grid('linestyle','none','tickdir','out');
colorbar;

  对比下图可以发现,绘制在图右侧的颜色调划分上存在差异,这就是设置了m的差别,根据需要选择合适的命令参数,能够绘出更加符合的图示:



2. 关于m_contfbar

  m_contfbar函数用于添加色标,以示地图上的等值线或填充的数据的颜色对应的数值范围。

  m_contfbar函数的一般形式是:

[ ax,h ] = m_contfbar(lon,lat,DATA,LEVELS)
% M_CONTFBAR Draws a colour bar for contourf plots 
%    M_CONTFBAR([X1,X2],Y,DATA,LEVELS) draws a horizontal colourbar
%    between the normalized coordinates (X1,Y) and (X2,Y) where
%    X/Y are both in the range 0 to 1 across the current axes.
%    Negative values can be used to position outside the axis.
%
%    Differences from COLORBAR are: the bar is divided into solid
%    colour patches exactly corresponding to levels provided by
%    CONTOURF(DATA,LEVELS) instead of showing the whole continuous
%    colourmap, the parent axis is not resized, the axis can be made
%    as large or small as desired, and the presence of values 
%    above/below contoured levels is indicated by triangular pieces
%    (MATLAB 2014b or later).
%
%    M_CONTFBAR(X,[Y1,Y2],...) draws a vertical colourbar
%
%    The DATA,LEVELS pair can also be replaced with CS,CH where
%    [CS,CH]=CONTOURF(DATA,LEVELS).
%
%    M_CONTFBAR(...,'parameter','value') lets you specify extra
%    parameter/value pairs for the colourbar in the usual handle-graphics
%    way. Parameters you might set include 'xticks','xticklabels',
%    'xscale','xaxisloc' (or corresponding y-axis parameters for
%    a vertical colourbar) and 'fontsize'.
%
%    Additional parameter/value pairs allow special customization of the
%    colourbar:
%        'axfrac' : width of the colourbar (default 0.03)
%        'endpiece' : 'yes' (default) or 'no' show triangular
%                      endpieces.
%        'levels' : 'set' (default) shows a colourbar with exactly
%                   the levels in the LEVELS argument. 
%                   'match' shows only the subsect of levels actually
%                   used in the CONTOURF call. E.g., if your data ranges
%                   from (say) 121 to 192, and LEVELS=[10:10:300],
%                   then only levels in 130:10:190 actually appear in both
%                   the CONTOURF and the colourbar.
%         'edgecolor' : 'none' removes edges between colors.
%
%    [AX,H]=M_CONTFBAR(...) returns the handle to the axis AX and to
%    the contourobject H. This is useful to add titles, xlabels, etc.
%
%    M_CONTFBAR(BAX,...) where BAX is an axis handle draws the colourbar
%    for that axis.

其中:

  • lon,lat 控制色标的位置,([lon1 lon2],[lat]…)表示横向色标;([lon1],[lat1 lat2]…)纵向色标;
  • DATA 进行绘图的输入数据;
  • axfrac 设置色标宽度 设置value数值;
  • endpiece 设置结束端,yes 或 no;
  • edgecolor 色标框边缘颜色,可以设置’r’ 、'g’等matlab内置颜色,也可以设置none;

m_contfbar函数的使用示例(在官网示例上不断尝试修改):

m_proj('lambert','lat',[5 24],'long',[105 125]);set(gcf,'color','w')   % Set background colour before m_image call
caxis([-6000 0]);
colormap(flipud([flipud(m_colmap('blues',10));m_colmap('jet',118)]));
m_etopo2('shadedrelief','gradient',3);
m_gshhs_i('patch',[.8 .8 .8]);
m_grid('box','fancy');
ax=m_contfbar(.97,[.5 .9],[-6000 0],[-6000:100:000],'edgecolor','none','endpiece','no','axfrac ',0.1);
xlabel(ax,'meters','color','k');

  示例运行结果,上边的可选参数可自行修改。


3. 结语

   本篇介绍了用于创建和管理颜色映射函数(m_colmap)和 为轮廓图绘制颜色条的函数(m_contfbar),通过示例展示了各函数的基本用法,对于绘制常见地学图已经够用了,后面如果发现还有其它相关函数再进行补充希望对绘图的你有所帮助






😜
😜😜
😜😜😜😜

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处:http://www.mzph.cn/web/42682.shtml

如若内容造成侵权/违法违规/事实不符,请联系多彩编程网进行投诉反馈email:809451989@qq.com,一经查实,立即删除!

相关文章

基于深度学习的电影推荐系统

1 项目介绍 1.1 研究目的和意义 在电子商务日益繁荣的今天&#xff0c;精准预测商品销售数据成为商家提升运营效率、优化库存管理以及制定营销策略的关键。为此&#xff0c;开发了一个基于深度学习的商品销售数据预测系统&#xff0c;该系统利用Python编程语言与Django框架&a…

SQLite 命令行客户端 + Windows 批处理应用

SQLite 命令行客户端 Windows 批处理应用 下载 SQLite 客户端1. Bat 辅助脚本1. 执行SQL.bat执行 2. 导出Excel.bat执行效果 3. 导出HTML.bat执行效果 4. 清空-订单表.bat5. 订单表.bat 2. 测试 SQL1. 创建订单表.sql2. 插入订单表.sql3. 查询订单表.sql4. 清空订单表.sql5. 删…

Qt Qwt 图表库详解及使用

文章目录 Qt Qwt 图表库详解及使用一、Qwt 概述二、安装 Qwt1. 下载和编译 Qwt2. 在项目中使用 Qwt三、Qwt 的基本使用1. 创建一个简单的折线图2. 添加图例和自定义样式四、Qwt 的交互功能1. 启用缩放和平移2. 启用数据点选择五、Qwt 的高级特性1. 实时数据更新2. 多轴绘图六、…

nvm 管理多版本 node

1、下载 先不安装node 下载 nvm 1.1.10-setup.zip 解压&#xff1a;nvm&#xff1a;https://nvm.uihtm.com/ 新建nodejs/node、nodejs/nvm文件夹用于存放node版本和nvm安装路径 安装nvm&#xff1a;上述链接有安装教程 查看是否安装成功&#xff1a;重新打开cmd 输入 nvm nv…

Hyper-V克隆虚拟机教程分享!

方法1. 使用导出导入功能克隆Hyper-V虚拟机 导出和导入是Hyper-V服务器备份和克隆的一种比较有效的方法。使用此功能&#xff0c;您可以创建Hyper-V虚拟机模板&#xff0c;其中包括软件、VM CPU、RAM和其他设备的配置&#xff0c;这有助于在Hyper-V中快速部署多个虚拟机。 在…

深入理解基本数据结构:数组详解

引言 在计算机科学中&#xff0c;数据结构是存储、组织和管理数据的方式。数组作为最基础的数据结构之一&#xff0c;广泛应用于各种编程场景。在这篇博客中&#xff0c;我们将详细探讨数组的定义、特点、操作及其在不同编程语言中的实现。 什么是数组&#xff1f; 数组是一种…

原生android的内存性能提升方面的方案大致设计

一 测试目标&#xff1a; 以满足用户设备的内存性能和不杀后台为目标。 1&#xff1a;满足用户设备的内存性能是指不出现因为内存原因导致的安卓设备死机&#xff0c;卡顿等问题。 2&#xff1a;满足不杀后台是指整个设备使用时&#xff0c;不出现后台app被杀。 通常是估算如果…

构造函数注入@RequiredArgsConstructor

Api(tags "用户管理接口") RequiredArgsConstructor RestController RequestMapping("users") public class UserController {private final IUserService userService;PostMappingApiOperation("新增用户")public void saveUser(RequestBody U…

输入框输入值之后,检索表格中是否存在输入框中的值,存在就让当前文字为红色

this.searchValue为输入框的值 createKeywordHtml_content(data) { if (data undefined) { return data; } if (typeof data ! string) { data String(data) } let value data.replace(this.searchValue, <span style"color:#FF5555">$&</span>…

来一组爱胜品1133DN PRO打印机的照片

刚拆箱的机器正面照片 打开前盖正准备要安装原装耗材 下图是原装耗材&#xff0c;硒鼓型号是DR2833、碳粉盒型号是TN2833,鼓组件打印页数12000页&#xff0c;TN2833标准容量粉盒打印页数1600页/5%覆盖率&#xff0c;TN2833H大容量粉盒打印页数3000页/5%覆盖率、TN2833L超大容量…

Intel base instruction -- cvttsd2si

将截断双精度浮点数并转换为有符号整数。 4958: 8b 05 82 49 00 00 mov 0x4982(%rip),%eax # 92e0 <age_to_colorBase> // eaxgvar_92e0 495e: 48 8d 15 7b 49 00 00 lea 0x497b(%rip),%rdx # 92e0 <age_to_colorBase&g…

慢性肾脏病-MR+转录组文献

Identification of novel therapeutic targets for chronic kidney disease and kidney function by integrating multi-omics proteome with transcriptome - PMC (nih.gov) 数据和材料 Our pQTL summary data were acquired from previously published studies and can be f…

三. 根文件系统构建

根文件系统构建好以后就意味着我们已经拥有了一个完整的,可以运行的最小系统. 一. 根文件系统简介 根文件系统一般也叫做 rootfs&#xff0c;那么什么叫根文件系统&#xff1f;Linux 中的根文件系统更像是一个文件夹或者叫做目录,在这个目录里面会有很多的子目录,目录下的文件…

《妃梦千年》第二十九章:朝中波澜

第二十九章&#xff1a;朝中波澜 自从被封为护国夫人后&#xff0c;林清婉在大周的地位愈发稳固&#xff0c;她的智慧和勇气不仅赢得了皇上的信任&#xff0c;也获得了朝中众臣的敬佩。然而&#xff0c;这也引来了部分人的嫉妒和不满&#xff0c;他们开始在暗中谋划&#xff0…

AdaBoost集成学习算法理论解读以及公式为什么这么设计?

本文致力于阐述AdaBoost基本步骤涉及的每一个公式和公式为什么这么设计。 AdaBoost集成学习算法基本上遵从Boosting集成学习思想&#xff0c;通过不断迭代更新训练样本集的样本权重分布获得一组性能互补的弱学习器&#xff0c;然后通过加权投票等方式将这些弱学习器集成起来得到…

RightFont 8.7.0 Mac专业字体管理工具

RightFont 适用于 macOS 的终极字体管理器应用程序&#xff0c;提供无缝的字体管理体验。它结合了速度、直观的功能和专业的功能&#xff0c;使用户能够轻松预览、安装、组织和共享字体。 RightFont 8.7.0 Mac下载 RightFont 8.0的新增功能 RightFont 8.0 带来了全新的智能选…

【电脑应用技巧】如何寻找电脑应用的安装包华为电脑、平板和手机资源交换

电脑的初学者可能会直接用【百度】搜索电脑应用程序的安装包&#xff0c;但是这样找到的电脑应用程序安装包经常会被加入木马或者强制捆绑一些不需要的应用装入电脑。 今天告诉大家一个得到干净电脑应用程序安装包的方法&#xff0c;就是用【联想的应用商店】。联想电脑我是一点…

比赛获奖的武林秘籍:05 电子计算机类比赛国奖队伍技术如何分工和学习内容

比赛获奖的武林秘籍&#xff1a;05 电子计算机类比赛国奖队伍技术如何分工和学习内容 摘要 本文主要介绍了在电子计算机类比赛中技术层面上的团队分工和需要学习的内容&#xff0c;分为了嵌入式硬件、嵌入式软件、视觉图像处理、机械、上位机软件开发和数据分析等六个方向&am…

文心一言 VS 讯飞星火 VS chatgpt (299)-- 算法导论22.1 3题

三、有向图 G ( V , E ) G(V,E) G(V,E) 的转置是图 G T ( V , E T ) G^{T} (V,E^{T}) GT(V,ET)&#xff0c;这里 E T { ( v , u ) ∈ V V E^{T} \{(v,u)∈ V \times V ET{(v,u)∈VV:(u,v)∈ E}$因此&#xff0c;图 G T G^{T} GT 就是将有向图 G G G中所有边的方向反过来…

java LogUtil输出日志打日志的class文件内具体方法和行号

最近琢磨怎么把日志打的更清晰&#xff0c;方便查找问题&#xff0c;又不需要在每个class内都创建Logger对象&#xff0c;还带上不同的颜色做区分&#xff0c;简直不要太爽。利用堆栈的方向顺序拿到日志的class问题。看效果&#xff0c;直接上代码。 1、demo test 2、输出效果…