how to change the transparency of individual colors in the colormap of an image?

12 次查看(过去 30 天)
Hello,
I'm using bubblechart to display my data as shown below;
bubblechart(x2xz,z2xz,ones(size(x2xz)),n2xz,'MarkerFaceAlpha',0.1,'MarkerEdgeAlpha',0.2);
-this works. However it would be better if I could make MarkerFaceAlpha a variable, so that it changes based on the value of n2xz (which currently controls the colour of the bubbles). Unfortunately MarkerFaceAlpha has to be a scalar, not a vector, with bubblechart.
The plot command accepts colours in this format (where the fourth column is the transparency); 'Color',[0.0 0.0 1.0 0.3], but when I build a colormap with four columns and try to use that instead of using the MarkerFaceAlpha option, the colormap command rejects it.
I have googled this and searched Matlab Answers, but nothing useful was found.
Any suggestions would be gratefully received. Thank you.
Gordon Cooper

回答(1 个)

DGM
DGM 2024-5-18
编辑:DGM 2024-5-18
I don't have a new enough version to use bubblechart() or dig into its properties, but the behavior of plot() with RGBA tuples is undocumented, so don't extrapolate too far about what might be supported.
I don't know of anything which accepts a Mx4 RGBA color table. The few places I remember finding RGBA tuples in hidden properties, they weren't consistently unit-scale floats. You might be able to dig into hidden properties to make undocumented things work, but they might not.
Maybe someone has more insight into the newer stuff though.

类别

Help CenterFile Exchange 中查找有关 Data Distribution Plots 的更多信息

产品


版本

R2024a

Community Treasure Hunt

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

Start Hunting!

Translated by