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.mfbz.cn/a/788152.html

如若内容造成侵权/违法违规/事实不符,请联系我们进行投诉反馈qq邮箱809451989@qq.com,一经查实,立即删除!

相关文章

从Helm到 Operator:Kubernetes应用管理的进化

&#x1f9f0;Helm 的作用 在开始前需要先对 kubernetes Operator 有个简单的认识。 以为我们在编写部署一些简单 Deployment 的时候只需要自己编写一个 yaml 文件然后 kubectl apply 即可。 apiVersion: apps/v1 kind: Deployment metadata: labels: app: k8s-combat …

【系统架构设计】计算机组成与体系结构(二)

计算机组成与体系结构 计算机系统组成存储器系统前言主存储器存储器存储数量&#xff08;计算&#xff09; 辅助存储器&#xff08;以磁盘为例&#xff09;Cache存储器 流水线 计算机系统组成 存储器系统 前言 存储器用来存放程序和数据的部件&#xff0c;是一个记忆装置&am…

【网络安全的神秘世界】XSS基本概念和原理介绍

&#x1f31d;博客主页&#xff1a;泥菩萨 &#x1f496;专栏&#xff1a;Linux探索之旅 | 网络安全的神秘世界 | 专接本 | 每天学会一个渗透测试工具 一、基本概念 恶意攻击者往web页面插入恶意代码脚本&#xff08;JS代码&#xff09;&#xff0c;当用户浏览该页面时&#xf…

泛微开发修炼之旅--36通过js控制明细表中同一列中多个浏览框的显示控制逻辑(明细表列中多字段显示逻辑控制)

文章链接&#xff1a;36通过js控制明细表中同一列中多个浏览框的显示控制逻辑&#xff08;明细表列中多字段显示逻辑控制&#xff09;

0基础学会在亚马逊云科技AWS上搭建生成式AI云原生Serverless问答QA机器人(含代码和步骤)

小李哥今天带大家继续学习在国际主流云计算平台亚马逊云科技AWS上开发生成式AI软件应用方案。上一篇文章我们为大家介绍了&#xff0c;如何在亚马逊云科技上利用Amazon SageMaker搭建、部署和测试开源模型Llama 7B。下面我将会带大家探索如何搭建高扩展性、高可用的完全托管云原…

安防综合管理/视频汇聚平台EasyCVR视频监控存储技术:高效稳定的视频数据保障方案

随着科技的飞速发展&#xff0c;视频监控已成为现代社会不可或缺的一部分。无论是城市治安、交通管理&#xff0c;还是商业安保、家庭监控&#xff0c;视频监控都发挥着至关重要的作用。而在这背后&#xff0c;视频监控存储技术则是确保监控数据得以长期保存、高效检索和可靠利…

技术速递|VS Code Java 6月更新 - 项目设置功能增强!大量 Spring 新特性

作者&#xff1a;Nick Zhu 排版&#xff1a;Alan Wang 大家好&#xff0c;欢迎阅读 Visual Studio Code for Java 的六月更新&#xff01;在这篇博客中&#xff0c;我们将分享项目设置项目的重要更新以及一系列 Spring 的功能改进&#xff0c;让我们开始吧&#xff01; 项目设…

分布式锁(仅供自己参考)

分布式锁&#xff1a;满足分布式系统或集群式下多进程可见并且互斥的锁&#xff08;使用外部的锁&#xff0c;因为如果是集群部署&#xff0c;每台服务器都有一个对应的tomcat&#xff0c;则每个tomcat的jvm就不同&#xff0c;锁对象就不同&#xff08;加锁的机制&#xff0c;每…

(自用)共享单车服务器(二) 项目日志

stdin、stdout、stderr 注意&#xff1a;stderr是不缓存的&#xff0c;stdout则进行行间缓存。接下来我们看下行间缓存的效果&#xff0c;请参考以下代码&#xff1a; #include "stdio.h" #include <unistd.h>int main(int argc, char** argv) {for (int i 0…

万字长文MySQL Binlog 详细指南

目录 第一阶段 MySQL Binlog 基础用法1. Binlog基本概念1.1 什么是Binlog1.2 Binlog的作用1.3 Binlog格式 2. 配置和管理Binlog2.1 开启Binlog2.2 设置Binlog文件大小和保留时间2.3 查看Binlog状态 3. Binlog的实际应用3.1 数据恢复3.2 主从复制3.3 审计 4. Binlog工具使用4.1 …

吴恩达机器学习笔记2.1 - 什么是机器学习

吴恩达机器学习笔记2.1 - 什么是机器学习 最早的机器学习 1959年&#xff0c;亚瑟塞缪尔(Arthur Samuel)将机器学习定义为“Field of study that gives computers the ability to learn without being explicitly programmed”&#xff08;无需编程即可学习的研究领域&#xf…

谷粒商城 - 编写一个自定义校验注解

目录 开始 未来实现效果 第一步&#xff1a;编写自定义校验注解 第二步&#xff1a;编写自定义校验器 第三步&#xff1a;编写配置文件 效果演示 开始 未来实现效果 编写一个 ListValue 注解&#xff0c;可以实现功能有&#xff1a; 限定字段的值&#xff0c;例如指定只…

解读BASE理论:高可用性与性能的完美平衡

Base概念 BASE 理论是一种处理大规模分布式系统中的数据一致性问题的思路。相比于传统的严格一致性&#xff0c;它更灵活&#xff0c;适用于那些需要高可用性和性能的系统。BASE 理论由三个部分组成&#xff1a; 基本可用&#xff08;Basically Available&#xff09; 基本可用…

Unity通过NDK实现C#与C++之间的相互调用

由于一些历史遗留问题&#xff0c;我们项目还在使用一套C实现的Box2D定点数的库&#xff0c;由于最近修改了视野算法所以需要重新打包安卓的【.so】文件&#xff0c;特此记录 1、关于NDK 在Android平台&#xff0c;C/C需通过NDK编译成动态链接库.so文件&#xff0c;然后C#中通过…

天士力“数智本草”大模型如何赋能中药药品研发工作?

天士力“数智本草”大模型如何赋能中药药品研发工作&#xff1f; 目前&#xff0c;“数智本草”大模型如何配合天士力研发工作&#xff1f;对新药研发、中药二次开发等产生了什么价值&#xff1f;能否介绍一些具体的成果案例&#xff1f; “数智本草”大模型目前已经形成智能问…

免费下载工具 -- Free Download Manager(FDM) v6.24.0.5818

软件简介 Free Download Manager (FDM) 是一款免费的功能强大的下载管理软件&#xff0c;适用于多种操作系统&#xff0c;包括 Windows、macOS、Android 和 Linux。这款软件的特色在于它快速、安全且高效的下载能力。它可以下载各种热门网站的影片&#xff0c;支持 HTTP/HTTP…

【内网渗透】MSF渗透阶段的常用指令笔记

目录 渗透阶段划分 msfvenom 常用参数 各平台生成payload命令 Meterpreter Meterpreter的常用命令 基本命令 常用命令 针对安卓手机的一些命令 针对Windows的一些命令 文件系统命令 生成木马反弹shell(以linux靶机为例) 木马生成 配置监控 攻击利用 渗透阶段划分…

人工智能算法工程师(中级)课程2-Opencv视觉处理之高级操作

大家好&#xff0c;我是微学AI&#xff0c;今天给大家介绍一下人工智能算法工程师(中级)课程2-Opencv视觉处理之高级操作。在上一节课中的OpenCV基础操作我们了解到OpenCV是一个开源的计算机视觉软件库。它提供了各种视觉处理函数&#xff0c;并支持多种编程语言&#xff0c;如…

2-29 基于matlab的CEEMD

基于matlab的CEEMD&#xff08;Complementary Ensemble Empirical Mode Decomposition&#xff0c;互补集合经验模态分解&#xff09;&#xff0c;先将数据精心ceemd分解&#xff0c;得到imf分量&#xff0c;然后通过相关系数帅选分量&#xff0c;在求出他们的样本熵的特征。用…

HTML语言常见标签

语法 HEAD部分的HTML标签 1 标题标签 <title>标题内容</title> 2 段落标签 <meta charset"utf-8"/> BODY部分的HTML标签 1标题标签&#xff08;独占一行&#xff09;<h1>标题内容</h1> 2段落标签&#xff08;独占一行&#xff09;…