Hi I have the 3D matrix daily_renewables_excess which I am trying to plot a 3D bar graph for the x y and z dimensions in axis.
The size(daily_renewables_excess) is 11,7,10. So I am trying to get a 3D bar chart with 11 x intervals of x, 7 of y and 10 of z.
However when i try
figure;
bar3(daily_renewables_excess(:,:,:))
I get an error saying “Error using bar3 (line 39)
Inputs must be 2-D.”
From my understanding of the documentation, the bar3 function will plot a 3D bar as above.
Do I need to rearrange the matrices somehow?
thank you
Since you have a 3D matrix (volume) you cannot simultaneously show 3 intervals (3 axis) + a scale value for the bars (4th variable). This would amount to plotting a 4D diagram (e.g. using color to color-code the 4-th dimension, bar size to size-code it, or even vertical stacking).
For example, the following volume
Dis of size[11x10x7]and you can get 7bar3plots by indexing in the 3rd (z) dimensionWhat you can do instead is reshape in either
x-ory-dimesions, sort (in order to keep the notion of ordered intervals (inx-ory-respectively) and plot with bar3 the resulting matrices.