How can I apply variable transparency to a plot using scatter3?

42 ビュー (過去 30 日間)
Steffen Adria
Steffen Adria 2011 年 7 月 4 日
編集済み: Jacek Wodecki 2024 年 7 月 11 日
I'm producing a 3D model, and interior points happen to be more interesting to me. I have a 4-column matrix representing (x,y,z,intensity), and I'm most interested in the high-intensity points; currently they're coloured by intensity. Can I make it so that the transparency of low-intensity points is increased (but I need them to still be visible)?
Thanks
  2 件のコメント
Steffen Adria
Steffen Adria 2011 年 7 月 14 日
I have found a solution! I scaled both the colour and *size* of my points so that the outer, less intense points are smaller than the inner, more intense points I want to see, so I can see past the outer layer!
raym
raym 2017 年 6 月 4 日
Great! I also have same problem

サインインしてコメントする。

採用された回答

Patrick Kalita
Patrick Kalita 2011 年 7 月 5 日
MATLAB doesn't allow you to control the transparency of markers.
If you don't have a tremendous number of data points you could try drawing small spherical surfaces at each data point. Then you could control the transparency of those surfaces. Here's a File Exchange submission that might help you get started.
  6 件のコメント
Walter Roberson
Walter Roberson 2017 年 6 月 4 日
In R2014a and earlier, scatter3() uses patches. In R2014b and later, it does not.
In R2014b and later, there is MarkerFaceAlpha property that can be used to set a single transparency for all of the points.
In R2014b and later, to adjust each of the transparencies individually, then if h is the handle returned by calling scatter3(),
N = h.MarkerHandle.FaceColorData;
N(4,:) = new transparency data, expressed as integer values from 0 to 255
h.MarkerHandle.FaceColorData = N;
Jacek Wodecki
Jacek Wodecki 2022 年 8 月 17 日
編集済み: Jacek Wodecki 2024 年 7 月 11 日
it doesn't work, matlab 2021b
EDIT: still doesn't work until 2024a

サインインしてコメントする。

その他の回答 (2 件)

Lockenlui
Lockenlui 2018 年 12 月 27 日
編集済み: Lockenlui 2018 年 12 月 27 日
You can use
h = scatter3(..)
alpha = 0.5;
set(h, 'MarkerEdgeAlpha', alpha, 'MarkerFaceAlpha', alpha)
in order to set the transparancy for the edge as well as the face of the marker.
  2 件のコメント
Jacek Wodecki
Jacek Wodecki 2022 年 8 月 17 日
it doesn't work, matlab 2021b
s yuan
s yuan 2023 年 10 月 6 日
It does work, matlab 2023b

サインインしてコメントする。


bym
bym 2011 年 7 月 4 日
I am not sure I understand the question, perhaps
slice()
would be useful?
  2 件のコメント
Steffen Adria
Steffen Adria 2011 年 7 月 4 日
I need to see the whole thing at once in 3D. I need to see the exterior most of all, but I'm also trying to see some points that might be lying just inside the surface. It's fuzzy data so some noise is present and I'm not sure where the boundary between empty space and the object is. I'm expecting that an intense core will be present under a thin layer of low-intensity points; I want to be able to see both.
KRUNAL
KRUNAL 2014 年 8 月 21 日
Were you able to find a solution to the above question Steffen. If so, can you please post your code here

サインインしてコメントする。

カテゴリ

Help Center および File ExchangePolygons についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by