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.pswp.cn/web/42682.shtml
繁體地址,請注明出處:http://hk.pswp.cn/web/42682.shtml
英文地址,請注明出處:http://en.pswp.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、輸出效果…