MATLAB添加色标(colorbar)

 时间:2024-10-12 02:30:08

1、第一,为峰值函数(peaks)的图形添加色标。启动MATLAB,新建脚本,输入如下代码:close all; clear 锾攒揉敫all; clcfigure(1)surf(peaks(30))colorbar('YTickLabel',{'Freezing','Cold','Cool',... 'Neutral','Warm','Hot','Burning','Nuclear'})

MATLAB添加色标(colorbar)

3、第三,在上述脚本的基础上,接着输入如下代码:figure(2)contourf(peaks(30))colormap coolcolorbar('location','SouthOutside')其中('location','southoutside')控制色标处于图形中的位置,还可以取North,South,East,West,Northoutside,Southoutside,Eastoutside,Westoutside。

MATLAB添加色标(colorbar)

5、第五,利用subplot对上述脚本进行改进,将figure 1与figure 2画在一张图。脚本改进如下:close all; clear all; clc%figure(1)subplot(2,1,1)surf(peaks(30))colorbar('YTickLabel',{'Freezing','Cold','Cool',... 'Neutral','Warm','Hot','Burning','Nuclear'})%figure(2)subplot(2,1,2)contourf(peaks(30))colormap coolcolorbar('location','SouthOutside')

MATLAB添加色标(colorbar)
  • 用matlab将plot后的图像保存
  • 如何修改matlab绘图中线条的粗细
  • 如何在matlab画的图中改变坐标显示的范围
  • 怎样在matlab图形中添加网格?
  • Matlab 画图 图例大小调整
  • 热门搜索
    ck是什么意思 破窗效应是什么意思 tel是什么意思 how是什么意思 呼叫转移是什么意思 hen是什么意思 右眼跳是什么预兆 磨牙是什么原因引起的 grey是什么意思 什么的孩子