如何在MATLAB 2014b中增加散点图中图例的标记大小? [英] How to increase marker size of the legend in scatter plot in MATLAB 2014b?

查看:1358
本文介绍了如何在MATLAB 2014b中增加散点图中图例的标记大小?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在散点图中发现了标记大小,图例在MATLAB 2014b中有所不同.我搜索了&从早期版本的MATLAB找到了一些解决方案,这些解决方案在最新版本中不适用.在我当前的版本中,图例中的标记大小非常小,几乎无法区分.有帮助吗?

I found marker size in the scatter plot and the legend is different in MATLAB 2014b. I searched & found some solution from earlier version of MATLAB, which are not applicable in the latest version. In my current version, the marker size in legend is so small that it is hardly distinguishable. Any help?

figure; 
hold on 
s1 = scatter(1, 1, 150, 'k', 'o') 
s2 = scatter(1, 2, 150, 'k', '+') 
s3 = scatter(2, 1, 150, 'k', 'x') 
h = legend('Circle', 'Plus', 'X', 'Location', 'NorthEast'); 
set(h, 'FontSize', 14) 
axis([0 3 0 3]) 

散点图和图例中的标记大小不同.如何增加图例条目和标记的标记大小?使其类似于散点图.

The marker size in the scatter and legend is different. How can I increase the marker size of legend entries & makes it similar to that of the scatter plot.

推荐答案

如果我理解正确,您想访问对legend的调用的icons输出并修改修补程序对象的MarkerSize属性是那些图标的孩子.

If I understand right, you want to access the icons output of the call to legend and modify the MarkerSize property of the patch objects that are children of those icons.

致电legend:

[h,icons,plots,legend_text] = legend('Circle', 'Plus', 'X', 'Location', 'NorthEast'); 

icons是一个6x1图形数组,如下所示:

icons is a 6x1 graphics array like so:

icons = 

  6x1 graphics array:

  Text     (Circle)
  Text     (Plus)
  Text     (X)
  Group    (Circle)
  Group    (Plus)
  Group    (X)

您需要的是与Group相关的元素.

What you need are the elements associated with a Group.

如果查看它们的属性(在此处为icons(4)),则会得到:

If you look at their properties (here icons(4)), you get:

icons(4)

 Group (Circle) with properties:

    Children: [1x1 Patch]
     Visible: 'on'
     HitTest: 'off'

  Show all properties

因此,有一个与之关联的补丁程序对象作为其子级.您想使用实例进行修改

So there is a patch object associated with it as its child. You want to modify it using for instance

icons(Some index).Children.MarkerSize

在您的情况下,您需要将对象4修改为6:

In your case, you need to modify objects 4 to 6:

for k = 4:6
icons(k).Children.MarkerSize = 20;
end

输出:

您当然可以自动化.我使用了R2015a,因此我希望其行为与R2014b相同.

you can automate this of course. I used R2015a so I expect the behavior to be the same for R2014b.

希望这就是您的意思!

这篇关于如何在MATLAB 2014b中增加散点图中图例的标记大小?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆