x-labels do not show in bar3 graph

1 次查看(过去 30 天)
In my plot only first x-label is showing up, what's the problem?
Here's the code I have:
X={1;2;3;4;5;6;7;8;9;10;11;12;13;14;15};
Y={2;3;2;3;4;2;3;4;2;3;4;2;3;4;5};
for j=1:15,
bar3(X{j},Y{j});view(-90,0);
hold on
end

采纳的回答

ChristianW
ChristianW 2013-2-7
Try hold on befor the loop:
X={1;2;3;4;5;6;7;8;9;10;11;12;13;14;15};
Y={2;3;2;3;4;2;3;4;2;3;4;2;3;4;5};
hold on
for j=1:15
bar3(X{j},Y{j});view(90,0);
end

更多回答(1 个)

Wayne King
Wayne King 2013-2-7
编辑:Wayne King 2013-2-7
Not sure what you're trying to do and why you are using bar3()
Y={2;3;2;3;4;2;3;4;2;3;4;2;3;4;5};
Y = cell2mat(Y);
bar_h = bar(Y);
bar_child = get(bar_h,'Children');
set(bar_child,'CData',Y); colormap(jet);
The above code maps colors to the height of the bars. With the colormap set to jet, you get blue for the minimum value and red for the maximum. You are always free to design your own colormap.

类别

Help CenterFile Exchange 中查找有关 Colormaps 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by