一、线句柄实例

>> 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 句柄绘图的更多相关文章

  1. matlab的绘图保存

      matlab的绘图和可视化能力是不用多说的,可以说在业内是家喻户晓的.Matlab提供了丰富的绘图函数,比如ez**系类的简易绘图函数,surf.mesh系类的数值绘图函数等几十个.另外其他专业工 ...

  2. MATLAB——PLOT绘图

    MATLAB——PLOT绘图 格式化绘图: 1.color: b g  r c m y k w blue green red  cyan magenta yellow black white 2.ty ...

  3. Matlab 常用绘图指令(二维图形)

    使用matlab的时候常常会忘掉一些指令,每次都要重新查找,挺麻烦的,这里收集一些常用的绘图指令,供自己和大家以后方便查找和使用. 1.例子-包含了常用绘图命令 clear clc %%数据准备 x ...

  4. Matlab高级绘图

    http://blog.csdn.net/haizimin/article/details/50372630 图形是呈现数据的一种直观方式,在用Matlab进行数据处理和计算后,我们一般都会以图形的形 ...

  5. 关于Matlab在绘图时中文字体显示不一致的问题

    我的运行环境: OS: Win10 教育版 64-bit Matlab版本:Matlab 2017a  64-bit 在使用Matlab绘图时,而横坐标轴.纵坐标轴.标题有汉字时,会发现在GUI的显示 ...

  6. Matlab三维绘图

    三维绘图 1 三维绘图指令 类 别 指 令 说 明 网状图 mesh, ezmesh 绘制立体网状图 meshc, ezmeshc 绘制带有等高线的网状图 meshz 绘制带有“围裙”的网状图 曲面图 ...

  7. Matlab 三维绘图与统计绘图

    一. 三维绘图 p = : pi/: *pi; x = cos(p); y = sin(p); z = p; plot3(x,y,z) x = -:.:; %有-2为起点,2为递增步长,2为终止点 y ...

  8. MATLAB plot 绘图的一些经验,记下来,facilitate future work

    [转载请注明出处]http://www.cnblogs.com/mashiqi 2016/03/28 % 调整figure的位置scrsz = get(0,'ScreenSize'); % 这个命令是 ...

  9. matlab基础绘图知识

    axis([xmin xmax ymin ymax])   %设置坐标轴的最小最大值 xlabel('string')                             %标记横坐标 ylabe ...

随机推荐

  1. 前端每日实战:146# 视频演示如何用纯 CSS 创作一个脉动 loader

    效果预览 按下右侧的"点击预览"按钮可以在当前页面预览,点击链接可以全屏预览. https://codepen.io/comehope/pen/wYvGwr 可交互视频 此视频是可 ...

  2. 「ReStory」在 Markdown 中自由书写 React 组件 (Beta)

    介绍 先睹为快 我们在开发一个小小的 React 组件库,但是我们遇到了一个大难题,那就是为我们的组件库书写一个合理的文档. 作为组件文档,我们非常希望我们的组件用例代码能够展现出来,是的我们在书写文 ...

  3. Vue请求第三方接口跨域最终解决办法!2020最终版!

    废话少说,再百度的近三个小时尝试了近10种方法无解后,终于皇天不负有心人! 这个vue axios 跨域问题被我解决了! 需求:请求客户端ip地址获取客户ip,再根据ip获取用户位置 工具:Vue,a ...

  4. python入门到放弃-基本数据类型之dcit字典

    1.概述 字典是python中唯一的一个映射类型,以{}大括号括起来的键值对组成 字典中的key是唯一的,必须是可hash,不可变的数据类型 语法:{key1:value,key2:value} #扩 ...

  5. 读《Java并发编程的艺术》学习笔记(一)

    接下来一个系列,是关于<Java并发编程的艺术>这本书的读书笔记以及相关知识点,主要是为了方便日后多次复习和防止忘记.废话不多说,直接步入主题: 第1章  并发编程的挑战 并发编程的目的是 ...

  6. 日常破解---XCTF_APP1获取flag记录

    日常破解---XCTF_APP1获取flag记录 一.题目来源   来源:XCTF社区安卓题目app1 二.解题记录     1.首先安装到模拟器中运行一下,如下图所示,点击一下按钮,弹出提示年轻人不 ...

  7. SIP压力测试——奇林软件kylinPET

    一.Sip协议简介: SIP(Session Initiation Protocol,会话初始协议)是由IETF(Internet Engineering Task Force,因特网工程任务组)制定 ...

  8. 死磕Lambda表达式(三):更简洁的Lambda

    我们都是阴沟里的虫子,但总还是得有人仰望星空.--<三体> 在之前的文章中介绍了Lambda表达式的基本语法和正确使用姿势,这次我来介绍一些Lambda更简洁的用法. 欢迎关注微信公众号: ...

  9. mybatis探究之延迟加载和缓存

    mybatis探究之延迟加载和缓存 一.什么是延迟加载 1.延迟加载的概念 在mybatis进行多表查询时,并非所有的查询都需要立即进行.例如在查询带有账户信息的用户信息时,我们们并不需要总是在加载用 ...

  10. P5596 【XR-4】题 笔记

    P5596 [XR-4]题 其实这题我昨天没做出来--所以今天写一下笔记 昨天我还信誓旦旦地说这一定是一道黑题\(OTZ\).果然菜是原罪. 另外吐槽一下科技楼机房频繁停电,昨天写了两小时的树刨和倍增 ...