Clear Filters
Clear Filters

Grouping in a bar3 plot

2 views (last 30 days)
Matthew
Matthew on 12 Aug 2012
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.

Answers (1)

Star Strider
Star Strider on 12 Aug 2012
Edited: Star Strider on 12 Aug 2012
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.

Categories

Find more on 2-D and 3-D Plots in Help Center and File Exchange

Tags

Products

Community Treasure Hunt

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

Start Hunting!