Grouping in a bar3 plot

2 次查看(过去 30 天)
Matthew
Matthew 2012-8-12
Hi,
I'm working with this plot, which is generated by this code.
I'm finding it hard to achieve what I want. I want to rotate each group around 90 degrees, to make use of the y-axis. I then want to cluster the groups into packs of 6 along the x-axis, with a space between each pack of 6. I then want to label each pack of 6 with a label along the x-axis.
How do you achieve this?
Alternatively, how do you do a bar chart specifying the x,y coordinate, the height (z) and colour for each bar - I could achieve the same thing with this knowledge.
I do have the statistics toolbox, if this is necessary. Is it possible to do something with hist3 or similar?
With very many thanks,
Matthew.

回答(1 个)

Star Strider
Star Strider 2012-8-12
编辑:Star Strider 2012-8-12
I don't entirely understand what you want to do, but this may be part of the answer. Using an example from the documentation:
figure(32767)
Z = magic(5);
h = bar3(Z);
colormap cool
colorbar
[az0 el0] = view % Find current orientation of figure
then experiment with view until you get the result you want:
figure(65535)
Z = magic(5);
h = bar3(Z);
colormap cool
colorbar
view([-10 60]) % Set new figure orientation
There may be other ways to do this, but this is the one I'm familiar with. You can also do it interactively in the plot window until you get orientation you like, then read the resulting [az el] values to incorporate into your code.
I'm sure you've already seen this documentation (core MATLAB), but Bar and Area Graphs may answer some of your other questions.

类别

Help CenterFile Exchange 中查找有关 2-D and 3-D Plots 的更多信息

标签

产品

Community Treasure Hunt

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

Start Hunting!

Translated by