Add fixed colorbar to volshow
이전 댓글 표시
I have my code which is plotting results in a loop. I am visualizing them on the volumeviewer in 3D. for every frame in my loop there is a new figure and it updates accordingly.
my code is this:
%% Initialize volume visualization
% Define global color scale limits
globalMin = -1.5; % Minimum value across all frames
globalMax = 1.5; % Maximum value across all frames
% Normalize your volume for consistent color mapping
normalizedData = (compressed_hbt - globalMin) / (globalMax - globalMin);
normalizedData(normalizedData < 0) = 0; % Clamp values below 0
normalizedData(normalizedData > 1) = 1; % Clamp values above 1
% Use 256-color colormap
cmap = jet(256);
% Create volume viewer only once
if i == 1
% Create volume viewer with white background
vol_hbt = volshow(zeros(size(compressed_hbt)), ...
'Colormap', cmap, ...
'Alphamap', (linspace(0,0.7,256).^2));
end
% Update Volshow with normalized data
vol_hbt.Data = normalizedData;
% Keep the colorbar visible by forcing a refresh in the figure
drawnow;
but I want to insert a colorbar with values fixed into the volume viewer. I tried different approaches, but it won't show in the window. the axis can just be a fixed jet colorbar iwth constant ticks & a title. How can i realize this?
채택된 답변
추가 답변 (1개)
Walter Roberson
2025년 4월 30일
0 개 추천
You cannot do that. volshow() creates a standalone chart object.
There is an internal vol_hbt.Parent.Axes property but it is a images.ui.graphics.internal.Axes not a standard axes matlab.graphics.axis.Axes and cannot serve as the parent for a colorbar.
댓글 수: 2
Lara
2025년 4월 30일
Walter Roberson
2025년 4월 30일
No, there is not. The vol_hbt.Parent.Axes object does not even have a Children property
카테고리
도움말 센터 및 File Exchange에서 Graphics Object Properties에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!
