フィルターのクリア

Transparency value in colormap

74 ビュー (過去 30 日間)
Zahra Yousefi Darani
Zahra Yousefi Darani 2022 年 4 月 27 日
移動済み: DGM 2023 年 3 月 6 日
For matching the color of data to colorbar, I need to define a colormap with 4 columns,
last column includes transparency, How can I define that?

採用された回答

DGM
DGM 2022 年 4 月 27 日
編集済み: DGM 2022 年 4 月 27 日
Colormaps and colorbars do not support RGBA formats (as far as I know). Transparency is handled separately by the AlphaData property on objects that support it.
It doesn't make any sense that you would need RGBA colormaps to "match color of data to the colorbar". The apparent color of a semitransparent colored element is a function of its own color and the color of objects beneath it. What do you expect to be beneath your graphics object and/or colorbar, and why would you require alpha blending the two in a scheme to reinvent basic colormapping? The mapping provided with colormaps/colorbars is 1D. Are you expecting to be able to implement a 2D mapping process by having alpha as an extra map dimension? If so, this tangent might be of interest.
Come to think of it, what sort of graphics object are you trying to do this on?
  5 件のコメント
DGM
DGM 2022 年 4 月 29 日
移動済み: DGM 2023 年 3 月 6 日
I think a hypothetical 1D RGBA colormapping process is conceivable. The ordering would simply be dependent on the relative locations of the colors in the colormap -- which could be any arbitrary trajectory in N dimensions.
I think the problem is in the rendering and usability. The only way you can visualize transparency is by putting something beneath it. So I see two possibilities:
  • The colorbar is rendered over a test pattern and the plot (e.g. a surface) is rendered over whatever is behind it (including itself). In this case, I don't think it's reasonable to expect any ability to visually correlate a particular semitransparent color with the corresponding point in the colorbar to any practical degree of accuracy.
  • The colorbar and plot object are rendered over identical solid color fields for sake of consistency and readability. In this case, transparency can simply be eliminated from the colormapping process entirely.
The first case might not be too big of a stretch if the requirements are minimal, the transparency is constant, and the background uncomplicated. It might not be the best, but it's easy enough to read something quantized like a transparent contourf() plot over a grayscale map, so maybe there are other cases that would be manageable.
I suppose that brings up another interpretation. Even if the alpha is constant and the background grayscale, how should the colorbar be presented?
  • As a 1D strip at 100% alpha (the normal behavior)
  • As a 1D strip at the chosen alpha, atop a uniform field at some (e.g. 50%) gray level
  • As a 2D patch that represents the colormap at the chosen alpha over a 0% to 100% gray sweep
Just throwing that out there.
Zahra Yousefi Darani
Zahra Yousefi Darani 2022 年 5 月 6 日
移動済み: DGM 2023 年 3 月 6 日
Great! Thanks!

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

その他の回答 (0 件)

カテゴリ

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

製品

Community Treasure Hunt

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

Start Hunting!

Translated by