Colors of the bar are not same for the same height in 3d bar plot after applying log scale
I’m trying to plot 3D graph with bars, in which I’m using colormap. I have found a work around to apply colormap on bar3:
b = […] % my data
for k = 1:length(b)
zdata = b(k).ZData;
b(k).CData = zdata;
b(k).FaceColor = ‘interp’;
end
colormap(‘jet’)
I’m also applying log scale in Z axis. But it was messing up my plot and I found a work around for this also.
% Z log fix
llim = .1;
h = get(gca,’Children’);
for i = 1:length(h)
ZData = get(h(i), ‘ZData’);
ZData(ZData==0) = llim;
set(h(i), ‘ZData’, ZData);
end
But I’m getting the following result after the log fix where the bars don’t have same color at the same Z value (height).
I’m trying to get results like the following plot.
Anyone know the solution?I’m trying to plot 3D graph with bars, in which I’m using colormap. I have found a work around to apply colormap on bar3:
b = […] % my data
for k = 1:length(b)
zdata = b(k).ZData;
b(k).CData = zdata;
b(k).FaceColor = ‘interp’;
end
colormap(‘jet’)
I’m also applying log scale in Z axis. But it was messing up my plot and I found a work around for this also.
% Z log fix
llim = .1;
h = get(gca,’Children’);
for i = 1:length(h)
ZData = get(h(i), ‘ZData’);
ZData(ZData==0) = llim;
set(h(i), ‘ZData’, ZData);
end
But I’m getting the following result after the log fix where the bars don’t have same color at the same Z value (height).
I’m trying to get results like the following plot.
Anyone know the solution? I’m trying to plot 3D graph with bars, in which I’m using colormap. I have found a work around to apply colormap on bar3:
b = […] % my data
for k = 1:length(b)
zdata = b(k).ZData;
b(k).CData = zdata;
b(k).FaceColor = ‘interp’;
end
colormap(‘jet’)
I’m also applying log scale in Z axis. But it was messing up my plot and I found a work around for this also.
% Z log fix
llim = .1;
h = get(gca,’Children’);
for i = 1:length(h)
ZData = get(h(i), ‘ZData’);
ZData(ZData==0) = llim;
set(h(i), ‘ZData’, ZData);
end
But I’m getting the following result after the log fix where the bars don’t have same color at the same Z value (height).
I’m trying to get results like the following plot.
Anyone know the solution? bar3, 3d plots, colormap MATLAB Answers — New Questions