Matlab Tricks(十四) —— 句柄(handle)(图形对象属性的读取与修改)

来源:互联网 发布:win7卸载不了软件 编辑:程序博客网 时间:2024/05/21 21:34

0. 句柄的获得

H = subplot(1,2,1);saveas(H, [pathname,filename], 'jpg');

1. h = plot(…)

a = 0:10:360;x = a*pi/180;h = plot(x, sin(x), x, cos(x))% 运行到这里的话,会弹出 figure 窗口,如果这时不关闭 figure 窗口% 在命令行界面,可以进行实时的交互操作,并在 figure 中予以显示>> h(1).LineWidth = 2;

2. 使用 get 函数读取图形对象的相关属性

  • 参数为句柄;

    >> p = plot(0:9);>> get(p)                                       % 执行该句时弹出的图像不要关闭;.....
  • 返回默认轴的字体大小

    font_size = get(0, 'DefaultAxesFontSize');
0 0
原创粉丝点击