MATLAB 句柄绘图
一、线句柄实例
>> h1=line([0:10],[0:10])%创建句柄值
h1 =
Line (具有属性):
Color: [0 0.4470 0.7410]
LineStyle: '-'
LineWidth: 0.5000
Marker: 'none'
MarkerSize: 6
MarkerFaceColor: 'none'
XData: [0 1 2 3 4 5 6 7 8 9 10]
YData: [0 1 2 3 4 5 6 7 8 9 10]
ZData: [1x0 double]
显示 所有属性

>> get(h1)%查询句柄属性
AlignVertexCenters: 'off'
Annotation: [1x1 matlab.graphics.eventdata.Annotation]
BeingDeleted: 'off'
BusyAction: 'queue'
ButtonDownFcn: ''
Children: [0x0 GraphicsPlaceholder]
Clipping: 'on'
Color: [0 0.4470 0.7410]
CreateFcn: ''
DeleteFcn: ''
DisplayName: ''
HandleVisibility: 'on'
HitTest: 'on'
Interruptible: 'on'
LineJoin: 'round'
LineStyle: '-'
LineWidth: 0.5000
Marker: 'none'
MarkerEdgeColor: 'auto'
MarkerFaceColor: 'none'
MarkerSize: 6
Parent: [1x1 Axes]
PickableParts: 'visible'
Selected: 'off'
SelectionHighlight: 'on'
Tag: ''
Type: 'line'
UIContextMenu: [0x0 GraphicsPlaceholder]
UserData: []
Visible: 'on'
XData: [0 1 2 3 4 5 6 7 8 9 10]
YData: [0 1 2 3 4 5 6 7 8 9 10]
ZData: [1x0 double]
get(gcf)%窗口对象的句柄(get current figure,gcf)
Alphamap: [1x64 double]
BeingDeleted: 'off'
BusyAction: 'queue'
ButtonDownFcn: ''
Children: [1x1 Axes]
Clipping: 'on'
CloseRequestFcn: 'closereq'
Color: [0.9400 0.9400 0.9400]
Colormap: [64x3 double]
CreateFcn: ''
CurrentAxes: [1x1 Axes]
CurrentCharacter: ''
CurrentObject: [0x0 GraphicsPlaceholder]
CurrentPoint: [0 0]
DeleteFcn: ''
DockControls: 'on'
FileName: ''
GraphicsSmoothing: 'on'
HandleVisibility: 'on'
IntegerHandle: 'on'
Interruptible: 'on'
InvertHardcopy: 'on'
KeyPressFcn: ''
KeyReleaseFcn: ''
MenuBar: 'figure'
Name: ''
NextPlot: 'add'
Number: 1
NumberTitle: 'on'
PaperOrientation: 'portrait'
PaperPosition: [3.0917 9.2937 14.8167 11.1125]
PaperPositionMode: 'auto'
PaperSize: [21.0000 29.7000]
PaperType: 'A4'
PaperUnits: 'centimeters'
Parent: [1x1 Root]
Pointer: 'arrow'
PointerShapeCData: [16x16 double]
PointerShapeHotSpot: [1 1]
Position: [680 558 560 420]
Renderer: 'opengl'
RendererMode: 'auto'
Resize: 'on'
SelectionType: 'normal'
SizeChangedFcn: ''
Tag: ''
ToolBar: 'auto'
Type: 'figure'
UIContextMenu: [0x0 GraphicsPlaceholder]
Units: 'pixels'
UserData: []
Visible: 'on'
WindowButtonDownFcn: ''
WindowButtonMotionFcn: ''
WindowButtonUpFcn: ''
WindowKeyPressFcn: ''
WindowKeyReleaseFcn: ''
WindowScrollWheelFcn: ''
WindowStyle: 'normal'
>> get(gca)%当前轴对象句柄(get current axes,gca)
ALim: [0 1]
ALimMode: 'auto'
ActivePositionProperty: 'outerposition'
AmbientLightColor: [1 1 1]
BeingDeleted: 'off'
Box: 'off'
BoxStyle: 'back'
BusyAction: 'queue'
ButtonDownFcn: ''
CLim: [0 1]
CLimMode: 'auto'
CameraPosition: [5 5 17.3205]
CameraPositionMode: 'auto'
CameraTarget: [5 5 0]
CameraTargetMode: 'auto'
CameraUpVector: [0 1 0]
CameraUpVectorMode: 'auto'
CameraViewAngle: 6.6086
CameraViewAngleMode: 'auto'
Children: [2x1 Line]
Clipping: 'on'
ClippingStyle: '3dbox'
Color: [1 1 1]
ColorOrder: [7x3 double]
ColorOrderIndex: 1
CreateFcn: ''
CurrentPoint: [2x3 double]
DataAspectRatio: [5 5 1]
DataAspectRatioMode: 'auto'
DeleteFcn: ''
FontAngle: 'normal'
FontName: 'Helvetica'
FontSize: 10
FontSmoothing: 'on'
FontUnits: 'points'
FontWeight: 'normal'
GridAlpha: 0.1500
GridAlphaMode: 'auto'
GridColor: [0.1500 0.1500 0.1500]
GridColorMode: 'auto'
GridLineStyle: '-'
HandleVisibility: 'on'
HitTest: 'on'
Interruptible: 'on'
LabelFontSizeMultiplier: 1.1000
Layer: 'bottom'
LineStyleOrder: '-'
LineStyleOrderIndex: 1
LineWidth: 0.5000
MinorGridAlpha: 0.2500
MinorGridAlphaMode: 'auto'
MinorGridColor: [0.1000 0.1000 0.1000]
MinorGridColorMode: 'auto'
MinorGridLineStyle: ':'
NextPlot: 'replace'
OuterPosition: [0 0 1 1]
Parent: [1x1 Figure]
PickableParts: 'visible'
PlotBoxAspectRatio: [1 0.7903 0.7903]
PlotBoxAspectRatioMode: 'auto'
Position: [0.1300 0.1100 0.7750 0.8150]
Projection: 'orthographic'
Selected: 'off'
SelectionHighlight: 'on'
SortMethod: 'childorder'
Tag: ''
TickDir: 'in'
TickDirMode: 'auto'
TickLabelInterpreter: 'tex'
TickLength: [0.0100 0.0250]
TightInset: [0.0363 0.0532 0.0134 0.0202]
Title: [1x1 Text]
TitleFontSizeMultiplier: 1.1000
TitleFontWeight: 'normal'
Type: 'axes'
UIContextMenu: [0x0 GraphicsPlaceholder]
Units: 'normalized'
UserData: []
View: [0 90]
Visible: 'on'
XAxis: [1x1 NumericRuler]
XAxisLocation: 'bottom'
XColor: [0.1500 0.1500 0.1500]
XColorMode: 'auto'
XDir: 'normal'
XGrid: 'off'
XLabel: [1x1 Text]
XLim: [0 10]
XLimMode: 'auto'
XMinorGrid: 'off'
XMinorTick: 'off'
XScale: 'linear'
XTick: [0 1 2 3 4 5 6 7 8 9 10]
XTickLabel: {11x1 cell}
XTickLabelMode: 'auto'
XTickLabelRotation: 0
XTickMode: 'auto'
YAxis: [1x1 NumericRuler]
YAxisLocation: 'left'
YColor: [0.1500 0.1500 0.1500]
YColorMode: 'auto'
YDir: 'normal'
YGrid: 'off'
YLabel: [1x1 Text]
YLim: [0 10]
YLimMode: 'auto'
YMinorGrid: 'off'
YMinorTick: 'off'
YScale: 'linear'
YTick: [0 1 2 3 4 5 6 7 8 9 10]
YTickLabel: {11x1 cell}
YTickLabelMode: 'auto'
YTickLabelRotation: 0
YTickMode: 'auto'
ZAxis: [1x1 NumericRuler]
ZColor: [0.1500 0.1500 0.1500]
ZColorMode: 'auto'
ZDir: 'normal'
ZGrid: 'off'
ZLabel: [1x1 Text]
ZLim: [-1 1]
ZLimMode: 'auto'
ZMinorGrid: 'off'
ZMinorTick: 'off'
ZScale: 'linear'
ZTick: [-1 0 1]
ZTickLabel: ''
ZTickLabelMode: 'auto'
ZTickLabelRotation: 0
ZTickMode: 'auto'
设置线条和窗口颜色
>> set(h1,'color',[1 0 0])%线条红色
>> set(gcf,'color','b')%背景蓝色

二、
clear
x=0:2*pi/180:2*pi;
y1=sin(x);
y2=cos(x);
plot(x,y1,x,y2,x,zeros(size(x)),'w');

h=get(gcf,'children');%得到图片属性
hh=get(gca,'children');%得到三条线的的属性
y11=get(hh(2),'ydata');%获取cos(x)的幅度,等于y2
set(hh(2),'ydata',y11/2);%设置新的幅度
set(hh(3),'linestyle','-.');%设置格式


set(gca,'DefaultTextColor',[1 0 0])%设置字体颜色
gtext('正弦')%添加字体,鼠标选择位置,点击出现
gtext('余弦')


set(0,'defaultfigurecolor',[0.9 0.9 0.9])%设置图片背景颜色
set(0,'defaultfigurecolor','default')%恢复为默认值

k=menu('请选择','plot','mesh','surf')

二、
1、把控件安装在图形窗口上
clear
h1=uicontrol('style','edit','tooltipstring','edit text')
h2=uicontrol('style','checkbox','position',[90 20 30 20],'tooltipstring','checkbox')
h3=uicontrol('style','listbox','position',[150 20 40 20],'tooltipstring','listbox')%[a b c d],(a,b)左下角位置,(c,d)宽和高
h4=uicontrol('style', 'pushbutton', 'Position' ,[210,20,30,20],'TooltipString', 'pushbutton')
h5=uicontrol('style', 'radiobutton', 'Position' ,[260,20,30,20],'TooltipString', 'Radiobutton')

2、
clear all
axes('position',[0.1 0.1 0.5 0.2])%坐标位置
x=0:0.5:10;y=x;plot(x,y)
axis([0 10 2 10])%显示范围

3、
clear all
subplot(2,1,1)
membrane %这是一个库函数
light('color',[0.9 0.5 0.1],'position',[0,-2,1])%风格省略为无穷远,光顺序通过(0 0 0)和(0 -2 1)
subplot(2,1,2)
membrane
light('color',[0.9 0.0 0.1],'style','local','position',[1,-1,1])%风格为本地光,光源在(1 -1 1)位置

4、
clear all
figure('color',[1 0.1 0],'position',[0 0 200 100],'name','ww')

三、imagesc
1、imagesc(A)将矩阵A中的元素数值按大小转化为不同颜色,并在坐标轴对应位置处以这种颜色染色。
clear all
C = [0 2 4 6; 8 10 12 14; 16 18 20 22];
imagesc(C)
colorbar

2、更改坐标轴
clear all
x = [5 8];
y = [3 6];
C = [0 2 4 6; 8 10 12 14; 16 18 20 22];
imagesc(x,y,C)
colorbar

翻转y轴
clear all
x = [5 8];
y = [3 6];
C = [0 2 4 6; 8 10 12 14; 16 18 20 22];
imagesc(x,y,C)
colorbar
axis xy;

clear all
x = [5 8];
y = [3 6];
C = [0 2 4 6; 8 10 12 14; 16 18 20 22];
imagesc(x,y,C)
colorbar
axis xy%翻转y轴
set(gca,'XDir','reverse')%翻转x轴
3、限制高度
C = [0 2 4 6; 8 10 12 14; 16 18 20 22];
clims = [4 18];
imagesc(C,clims)
colorbar

4、更改显示色调
clear
C = [1 2 3; 4 5 6; 7 8 9];
im = imagesc(C);
im.AlphaData = .5;

5、投影面
clear
Z = 10 + peaks;
surf(Z)
hold on
imagesc(Z)
colorbar

四、shading阴影函数
clear all
figure
subplot(2,2,1)
sphere(16)
title('Faceted Shading (Default)') subplot(2,2,2)
sphere(16)
shading flat
title('Flat Shading') subplot(2,2,3)
sphere(16)
shading interp
title('Interpolated Shading')

五、colorbar函数颜色
1、
close all; clear all; clc
figure(1)
surf(peaks(30))
colorbar('YTickLabel',{'Freezing','Cold','Cool','Neutral','Warm','Hot','Burning','Nuclear'})

2、
close all; clear all; clc
figure(1)
surf(peaks(30))
colormap jet
colorbar('YTickLabel',{'Freezing','Cold','Cool','Neutral','Warm','Hot','Burning','Nuclear'})

3、
close all; clear all; clc
figure(1)
surf(peaks(30))
colormap jet colorbar('location','SouthOutside','YTickLabel',{'Freezing','Cold','Cool','Neutral','Warm','Hot','Burning','Nuclear'})

六、findobj
1、
close all;clear;clc;
plot(1:10)
xlabel xlab %x轴名称为“xlab”
disp('findobj返回的对象句柄')
h=findobj
h1=findobj('tag','figure')


MATLAB 句柄绘图的更多相关文章
- matlab的绘图保存
matlab的绘图和可视化能力是不用多说的,可以说在业内是家喻户晓的.Matlab提供了丰富的绘图函数,比如ez**系类的简易绘图函数,surf.mesh系类的数值绘图函数等几十个.另外其他专业工 ...
- MATLAB——PLOT绘图
MATLAB——PLOT绘图 格式化绘图: 1.color: b g r c m y k w blue green red cyan magenta yellow black white 2.ty ...
- Matlab 常用绘图指令(二维图形)
使用matlab的时候常常会忘掉一些指令,每次都要重新查找,挺麻烦的,这里收集一些常用的绘图指令,供自己和大家以后方便查找和使用. 1.例子-包含了常用绘图命令 clear clc %%数据准备 x ...
- Matlab高级绘图
http://blog.csdn.net/haizimin/article/details/50372630 图形是呈现数据的一种直观方式,在用Matlab进行数据处理和计算后,我们一般都会以图形的形 ...
- 关于Matlab在绘图时中文字体显示不一致的问题
我的运行环境: OS: Win10 教育版 64-bit Matlab版本:Matlab 2017a 64-bit 在使用Matlab绘图时,而横坐标轴.纵坐标轴.标题有汉字时,会发现在GUI的显示 ...
- Matlab三维绘图
三维绘图 1 三维绘图指令 类 别 指 令 说 明 网状图 mesh, ezmesh 绘制立体网状图 meshc, ezmeshc 绘制带有等高线的网状图 meshz 绘制带有“围裙”的网状图 曲面图 ...
- Matlab 三维绘图与统计绘图
一. 三维绘图 p = : pi/: *pi; x = cos(p); y = sin(p); z = p; plot3(x,y,z) x = -:.:; %有-2为起点,2为递增步长,2为终止点 y ...
- MATLAB plot 绘图的一些经验,记下来,facilitate future work
[转载请注明出处]http://www.cnblogs.com/mashiqi 2016/03/28 % 调整figure的位置scrsz = get(0,'ScreenSize'); % 这个命令是 ...
- matlab基础绘图知识
axis([xmin xmax ymin ymax]) %设置坐标轴的最小最大值 xlabel('string') %标记横坐标 ylabe ...
随机推荐
- Python学习笔记--迭代
在Python中,迭代是通过for ... in来实现.只要是可迭代的对象都可以用for ... in来进行历遍. 常用的有list.tuple.dict等.举例如下: 列表的迭代: L=[1,2,3 ...
- 适合MCU用的C语言快速互转HEX(16进制)和原始字符串/数组方法
缘由 这个起因是昨晚群里有人在讨论怎么把字符串转成HEX方法最佳,讨论到最后变成哪种方法效率最优了.毕竟这代码是要在MCU上面跑的,要同时考虑到时间和空间的最优解. 当然讨论的是有结果的,具体实现的方 ...
- XCTF---easyjni的WriteUp
一.题目来源 题目来源:XCTF的mobile区的easyjni题目. 题目下载地址:题目链接地址 二.解题过程 1.下载好题目后,安装到夜神模拟器中,发现有一个输入框和一个按 ...
- [NodeJS] async 和 await 的本质
绝大多数nodejs程序员都会使用 async 和 await 关键字,但是极少有人能真正弄明白 async 和 await 的原理.这篇文章将从零“构建”出 async 和 await 关 ...
- 操作系统-schedule函数
1. Linux 0.11的调度函数schedule() 也就是找到了counter最大的进程,然后就跳出去执行switch_to,对应上面的优先级算法,而counter本身也是时间片,也作了轮转调度 ...
- 安装ArchLinux时遇到的部分问题
目录 一.网络问题 1.安装刚开始时连接wifi 2.安装完桌面后 二.卸载gnome桌面 三.启动桌面(以kde桌面为例) 1.立即启动桌面(start , stop) 2.设置开启自启动 (ena ...
- php遍历文件夹中所有的文件
遍历文件夹中的所有文件 思路:1.定义一个函数,把给定的文件夹当前目录遍历输出(用到的文件操作函数scandir():一次性读取当前文件夹所有的内容并以数组的形式返回.). 2.如果是文件夹则红色字体 ...
- 搭建私有 Nuget 服务器教程(1)
对于 .NET 开发者来说,nuget 是必不可少的程序包管理工具.相应地,大部分开发团队都需要在内部搭建 Nuget 服务器,以管理私有 nupkg 包.本教程所使用的 Nuget 服务器,不是微软 ...
- 初学react
React特点: 声明式设计:建议使用JSX来描述用户界面;构建组件:单向响应的数据流: JSX:JSX是一种JAVASCRIPT的语法扩展,元素是构成react的最小单位,JSX就是用来声明REAC ...
- 浅析Redis分布式锁---从自己实现到Redisson的实现
当我们在单机情况下,遇到并发问题,可以使用juc包下的lock锁,或者synchronized关键字来加锁.但是这俩都是JVM级别的锁,如果跨了JVM这两个锁就不能控制并发问题了,也就是说在分布式集群 ...