Matlab图形中的半透明标记 [英] Semi-transparent markers in Matlab Figures

查看:382
本文介绍了Matlab图形中的半透明标记的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想绘制一个带有填充标记的散点图,并使它们成为半透明的,这样当两个或多个标记重叠时,重叠区域将变得更加不透明.

I want to plot a scatter plot with filled markers and make them semi-transparent so when two or more markers overlap, the overlapping area will be more opaque.

我天真地想

sg = scatter(rand(1000,1),rand(1000,1), 'filled');
alpha(0.5)

是可以的,但是没有.还有

would work, but it doesn't. Also

set(get(sg, 'Children'), 'FaceAlpha', 0.2)

不起作用.有什么想法吗?

doesn't work. Any ideas?

推荐答案

AFAIK,您无法更改scatter中的绘图标记的alpha值.一种解决方案是 patch 自己绘制标记.可以为patch()对象设置Alpha值,并且当标记重叠时,您将获得所需的效果.但是,这可能会很麻烦,并且需要根据您的需要进行自定义.

AFAIK, you cannot change the alpha values of the plot markers in scatter. One solution would be to patch to draw markers yourself. Alpha values can be set for patch() objects and you will get the desired effect when markers overlap. However, this can get quite cumbersome and will need to be customized to your needs.

请参见此相关问题,其中该函数在问题确实如此.您可以以此为起点,然后从那里开始.

See this related question, where the function defined in the question does exactly that. You can use that as a starting point and work from there.

这篇关于Matlab图形中的半透明标记的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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