Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8434623
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 10, 20262026-06-10T06:42:27+00:00 2026-06-10T06:42:27+00:00

Hi I have the 3D matrix daily_renewables_excess which I am trying to plot a

  • 0

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

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-10T06:42:28+00:00Added an answer on June 10, 2026 at 6:42 am

    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 D is of size [11x10x7] and you can get 7 bar3 plots by indexing in the 3rd (z) dimension

    % random 3D input
    D = randi(10, [11, 10, 7]);
    [m,n,l] = size(D);
    % plot bar for first z-
    figure; bar3(D(:,:,1));
    

    enter image description here

    What you can do instead is reshape in either x- or y- dimesions, sort (in order to keep the notion of ordered intervals (in x- or y- respectively) and plot with bar3 the resulting matrices.

    % reshape to x
    Dx = reshape(D, m*l, n);
    Dx = sort(Dx, 1, 'descend'); 
    figure; bar3(Dx)
    

    enter image description here

    % reshape to y
    Dy = reshape(D, m, n*l);
    Dy = sort(Dy, 2, 'descend'); 
    figure; bar3(Dy)
    

    enter image description here

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have matrix of 90 by 90 and I am trying to get an
I have a matrix A which I want to convert into a data.frame of
I have matrix with 3 dimension (n*m*k). I am trying to fined the maximum
I have a matrix X(1e4,20) which takes on values 0:4 . I'm interested in
I have a matrix which is 36 x 2, but I want to seperate
I have a matrix in MATLAB from which I want to sample every other
I have a matrix of cells, call it M. The matrix dimensions are n^3.
I have a matrix x of size Nx2 (contains (x,y) coordinates) and a matrix
I have a matrix A with size (nr,nc), a vector of column indices B
I have a matrix class with the size determined by template parameters. template <unsigned

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.