当前位置:网站首页>How to realize different values and display different colors in MATLAB
How to realize different values and display different colors in MATLAB
2022-04-22 04:42:00 【The most important thing is to insist and never forget the orig】
Example 1
One 、 View

Two 、 Code
author :CoderMan
link :https://www.zhihu.com/question/503639152/answer/2257427351
source : You know
The copyright belongs to the author . Commercial reprint please contact the author for authorization , Non-commercial reprint please indicate the source .
clear;clc;
[x, y, z] = peaks(30);
min_z = min(z(:));
max_z = max(z(:));
% Mapping to 0 - 1
z = (z - min_z) ./ (max_z - min_z);
% Mapping to 0 - 1000
z = z * 1000;
% Color Simplicity Array set to data range size
c_map = zeros(1000, 3);
% green
c_map(1:160, :) = repmat([0, 1, 0], 160, 1);
% Blue
c_map(161:260, :) = repmat([0, 1, 1], 100, 1);
% yellow
c_map(261:530, :) = repmat([1, 1, 0], 270, 1);
% Red
c_map(530:end, :) = repmat([1, 0, 0], 471, 1);
subplot(1, 2, 1)
surf(x, y, z);
colormap(c_map)
colorbar
shading interp
subplot(1, 2, 2)
contourf(x, y, z);
colormap(c_map)
colorbar
Example 2 、MATLAB Draw a two-dimensional line gradient Color
x = -5:0.1:5; y = x.^2; z = x.^2; patch([x,nan],[y,nan],[z,nan],'EdgeColor','flat','LineWidth',1,'MarkerFaceColor','flat','FaceColor','none') colorbar
The effect is as follows :

% Load and save as mat Matrix of variables
load circRNA_ss cirRNA_ss
% Execute the following statements respectively
imagesc(circRNA_ss);
colormap jet
colorbar
color The domain value of is 0—1
plot(x,y,'Color',[1 0 0]); For red
plot(x,y,'Color',[0 1 0]); Representing green
plot(x,y,'Color',[0 0 1]); Representing blue
plot(x,y,'Color',[0.3 0.8 0.9]); Is a new color composed of three colors .
Display the color bar of the color scale - MATLAB colorbar - MathWorks China
版权声明
本文为[The most important thing is to insist and never forget the orig]所创,转载请带上原文链接,感谢
https://yzsam.com/2022/04/202204220437497353.html
边栏推荐
- 2022 a special equipment related management (elevator) retraining question bank and answers
- Creative geometry point line surface triangle Memphis poster banner advertising design AI vector background material
- Will the expired data of redis be deleted immediately?
- Financial retail map - transaction flow warning map
- 2021-08-14
- DHCP protocol workflow
- Mui pop up menu
- 15. Bufferevent client test connection server
- LeetCode 剑指 Offer 65. 不用加减乘除做加法***
- 6_ Data analysis modeling
猜你喜欢

6_ Data analysis modeling

kaggle实战4.1--时间序列预测问题

Queue II

Mui pop up menu

论文阅读 (48):A Library of Optimization Algorithms for Organizational Design

JVM shorthand

Unity 简单UI前缀树红点系统

2022 P cylinder filling training questions and answers

Bi set - SSM campus second-hand book sales system + thesis

Paper reading (48): a library of optimization algorithms for organizational design
随机推荐
Unity的随机数
2022年A特种设备相关管理(电梯)复训题库及答案
Deployment of web server, personal experience
DHCP protocol workflow
Vue project NPM run build when packaging the project, time stamp the version number of CSS and JS files to prevent the browser from caching
goland汉化解决方法(下载插件失败的情况下)
LeetCode 剑指 Offer 65. 不用加减乘除做加法***
【S32K3_STM&PIT_MCAL】
2022 question bank and answers of Shandong Province safety officer C certificate special operation certificate examination
7-2 symbol pairing | PTA
Mapbox creates multiple draggable marker points
Linked list Part III
2022T电梯修理考试试题及在线模拟考试
创意几何点线面三角形孟菲斯海报banneer广告设计ai矢量背景素材
目标检测--轻量级网络(截至2022-04-21)
链表第四篇
DS18B20 temperature sensor based on 51 single chip microcomputer
AT32 MCU F435/437 DFU DEMO
Es next related
How did Jian Daoyun, who started a business in a small team of 10 people and now has an income of more than 100 million without financing, do it?