Transparency value in colormap
이 질문을 팔로우합니다.
- 팔로우하는 게시물 피드에서 업데이트를 확인할 수 있습니다.
- 정보 수신 기본 설정에 따라 이메일을 받을 수 있습니다.
오류 발생
페이지가 변경되었기 때문에 동작을 완료할 수 없습니다. 업데이트된 상태를 보려면 페이지를 다시 불러오십시오.
이전 댓글 표시
0 개 추천
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?
채택된 답변
0 개 추천
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
Zahra Yousefi Darani
2022년 4월 28일
이동: DGM
2023년 3월 6일
When programatically, color values ( four values, three for colours, the last for transparency) of every plot in every iteration of the loop are saved in a vector, after ending the loop, colorbar does not follow the colors of plots,
I should define a colormap based on color values that has been saved in the vector to force the colorbar to match my data,
but colormap only accepts three columns, do you have any solution for this issue? Or another way to make the colorbar matches the plotted data?
You'll have to provide an example of code that replicates the issue. I can't really tell what exactly is going on otherwise.
Walter Roberson
2022년 4월 28일
이동: DGM
2023년 3월 6일
colorbar is intended to map color to value, sorted by value. You do not seem to mention any associated value, just one set of RGBA per location.
Suppose that you have three locations, one of which is red=0, green=0, blue=max, alpha=max, and another is red=0, green=0, blue=max, alpha=max/2, and the third is red=max, green=0, blue=0, alpha=max . What order should those go into the colorbar, and how should the colorbar visually mark the difference between alpha=max and alpha=max/2 ?
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
2022년 5월 6일
이동: DGM
2023년 3월 6일
Great! Thanks!
추가 답변 (0개)
카테고리
도움말 센터 및 File Exchange에서 Color and Styling에 대해 자세히 알아보기
제품
참고 항목
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!웹사이트 선택
번역된 콘텐츠를 보고 지역별 이벤트와 혜택을 살펴보려면 웹사이트를 선택하십시오. 현재 계신 지역에 따라 다음 웹사이트를 권장합니다:
또한 다음 목록에서 웹사이트를 선택하실 수도 있습니다.
사이트 성능 최적화 방법
최고의 사이트 성능을 위해 중국 사이트(중국어 또는 영어)를 선택하십시오. 현재 계신 지역에서는 다른 국가의 MathWorks 사이트 방문이 최적화되지 않았습니다.
미주
- América Latina (Español)
- Canada (English)
- United States (English)
유럽
- Belgium (English)
- Denmark (English)
- Deutschland (Deutsch)
- España (Español)
- Finland (English)
- France (Français)
- Ireland (English)
- Italia (Italiano)
- Luxembourg (English)
- Netherlands (English)
- Norway (English)
- Österreich (Deutsch)
- Portugal (English)
- Sweden (English)
- Switzerland
- United Kingdom (English)
