【问题标题】:Customizing Data Cursor marker Matlab自定义数据光标标记 Matlab
【发布时间】:2017-10-31 22:08:02
【问题描述】:

是否有可能在 Matlab 中更改数据光标的标记形式和大小?我的意思是默认情况下它是黑色和方形的。例如,我想将其更改为蓝色和圆形。
我只发现了如何自定义数据提示文本。

谢谢。

【问题讨论】:

    标签: matlab cursor


    【解决方案1】:

    是 - 标记选项包含在未记录的 graphics.datatip 对象类的属性中。

    这些对象可作为 graphics.datacursormanager 对象的隐藏属性访问,可通过记录在案的 @987654321@ 函数访问。 .DataCursors 属性包含图中每个数据游标的这些对象的数组,.CurrentDataCursor 属性包含当前对象的对象。

    以您为例,将当前图形的当前数据光标的标记更改为蓝色圆圈,您可以执行以下操作:

    dcm_obj = datacursormode(gcf);
    set(dcm_obj.CurrentDataCursor, 'Marker','o', 'MarkerFaceColor','b');
    

    有关未记录功能的更多详细信息,请访问http://undocumentedmatlab.com/blog/controlling-plot-data-tips

    【讨论】:

      【解决方案2】:

      希望这会有所帮助.....对于白色背景和经典外观......

      • alldatacursors = findall(gcf,'type','hggroup')
      • set(alldatacursors,'FontSize',11)

      • set(alldatacursors,'FontName','Times')

      • set(alldatacursors,'BackgroundColor','w');

      【讨论】:

        【解决方案3】:

        是的,可以将figurePointer 属性设置为custom,然后根据您的选择设置PointerShapeCData 的值,但您不能更改为RGB 颜色格式。因为PointerShapeCData 属性接受值 1 和 2。值 1 表示黑色,2 表示白色。

        例如:

        a = zeros(16,16);   % create matrix with size of 16 X 16 with value zero
        a(:,:) = 1;         % assign all element value of matrix a to 1.
        figure('Pointer','custom ','PointerShapeCData',a); 
        
        % change some element value of a variable as 2 for change black to white.
        
        a(:,1) = 2;         
         a(:,3) = 2;
         a(:,7) = 2;
         figure('Pointer','custom ','PointerShapeCData',a);
        

        【讨论】:

        • 你能写一些代码来演示一下吗?
        • 问题是关于data cursorsPointer 属性会影响指针悬停在图窗上时显示的鼠标光标
        猜你喜欢
        • 2016-12-10
        • 2013-10-29
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 2013-03-28
        • 1970-01-01
        相关资源
        最近更新 更多