How can I make markers transparent?

조회 수: 4 (최근 30일)
Julius
Julius 2013년 3월 28일
I am seriously wondering how to plot markers with transparency in MATLAB. In the case of tight clusters of datapoints that are drawn on top of each other, I want to get a feeling for both density as well as being able to determine when two clusters overlap. There are certainly other applications too where marker transparency is desired. However, to the best of my knowledge, marker transparency in plots is still not supported. This question has been showing up a couple of times, yet none of the answers is satisfying my needs.
  1. matlab answer 6056
  2. matlab answer 24726
  3. stackoverflow 5893513
I would like to know whether there are any plans to add marker transparency as a feature to MATLAB, or whether there is an established workaround that robustly deals even if the plot shows thousands of datapoints.
  댓글 수: 1
Daniel Shub
Daniel Shub 2013년 3월 28일
Only TMW can tel you if they plan on implementing something (and they likely won't). That said, the chances that they will implement something increase if you let them know what you want.

댓글을 달려면 로그인하십시오.

답변 (2개)

Oleg Komarov
Oleg Komarov 2013년 3월 28일
Alternatively, if you have the Statistics TB, you can use scatterhist().
Two examples from the doc:
and
  댓글 수: 1
Julius
Julius 2013년 3월 28일
편집: Julius 2013년 3월 28일
Thanks, even though this does not exactly answer my question, the scatterhist addresses what I actually need, and is therefore quite helpful!

댓글을 달려면 로그인하십시오.


Sean de Wolski
Sean de Wolski 2013년 3월 28일
First, it sounds like you might want to use a 2d histogram or other plot type that is more designed for visualizing density.
Second, you can submit an enhancement request!
A simple work around is to write your own marker class that uses patches and sets their 'FaceAlpha' to the transparency level you want.
  댓글 수: 3
Julius
Julius 2013년 3월 28일
Thanks a lot for your hint, I will definitely file an enhancement request. Patches sounds like a big workaround to me, and I am trying to avoid those because workarounds accumulate. From a user point of view, it is very natural to not only have a property that sets the transparency for edges, but also one for markers. And yes, it is actually 21 figures with nearly 7000 datapoints each, which would result in around 140.000 patches. I have not tried whether MATLAB can handle this, but I do not want to spend a lot of efforts into workarounds.
Sean de Wolski
Sean de Wolski 2013년 3월 28일
Look at Oleg's suggestion. I think a regular scatter plot is the wrong visualization for what you are trying to do. You want to visualize density, so use a plot type that is specific for density rather than just clogging the screen.
Also, 7000 patches should be fine. On my non-workhorse laptop:
tic;for ii = 1:7000;patch(rand(1,3),rand(1,3),rand(1,3),'r');end;toc
Elapsed time is 0.867551 seconds.

댓글을 달려면 로그인하십시오.

카테고리

Help CenterFile Exchange에서 Graphics Performance에 대해 자세히 알아보기

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by