matlab——曲线色彩的修改

[复制链接]
673|0
 楼主| cooldog123pp 发表于 2024-6-22 20:43 | 显示全部楼层 |阅读模式
  1. h0=figure('toolbar','none',...
  2.     'position',[198 56 408 468],...
  3.     'name','my second gui');
  4. h1=axes('parent',h0,...
  5.     'position',[0.15 0.45 0.7 0.5],...
  6.     'visible','on');
  7. x=0:0.1:2*pi;
  8. k=plot(x,sin(x));
  9. xlabel('自变量X');
  10. ylabel('函数值Y');
  11. title('图形色彩改变');
  12. p1=uicontrol('parent',h0,...
  13.     'style','pushbutton',...
  14.     'backgroundcolor','r',...
  15.     'position',[60 100 50 30],...
  16.     'callback','set(k,''color'',''r'')');
  17. p2=uicontrol('parent',h0,...
  18.     'style','pushbutton',...
  19.     'backgroundcolor','g',...
  20.     'position',[170 100 50 30],...
  21.     'callback','set(k,''color'',''g'')');
  22. p3=uicontrol('parent',h0,...
  23.     'style','pushbutton',...
  24.     'backgroundcolor','b',...
  25.     'position',[280 100 50 30],...
  26.     'callback','set(k,''color'',''b'')');
  27. p4=uicontrol('parent',h0,...
  28.     'style','pushbutton',...
  29.     'backgroundcolor',[1 1 1],...
  30.     'fontsize',20,...
  31.     'fontweight','demi',...
  32.     'string','关闭',...
  33.     'position',[150 30 80 60],...
  34.     'callback','close');
  35. t1=uicontrol('parent',h0,...
  36.     'style','text',...
  37.     'string','红色',...
  38.     'fontsize',12,...
  39.     'fontweight','demi',...
  40.     'position',[60 120 50 20]);
  41. t2=uicontrol('parent',h0,...
  42.     'style','text',...
  43.     'string','绿色',...
  44.     'fontsize',12,...
  45.     'fontweight','demi',...
  46.     'position',[170 120 50 20]);
  47. t3=uicontrol('parent',h0,...
  48.     'style','text',...
  49.     'string','蓝色',...
  50.     'fontsize',12,...
  51.     'fontweight','demi',...
  52.     'position',[280 120 50 20]);


您需要登录后才可以回帖 登录 | 注册

本版积分规则

2304

主题

7626

帖子

31

粉丝
快速回复 在线客服 返回列表 返回顶部