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 7524865
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 30, 20262026-05-30T03:10:33+00:00 2026-05-30T03:10:33+00:00

All the three variables I am using to plot are matrix of size 1x1x100

  • 0

All the three variables I am using to plot are matrix of size 1x1x100. I am using this code line to plot:

hold on; 
for i=1:100
    plot3(R_L(:,:,i),N_Pc(:,:,i),CO2_molefraction_top_of_window(:,:,i),'o');
    xlabel('R_L');
    ylabel('N_P_c');
    zlabel('CO_2')
end

However, I am not getting the third axis, and hence the third variable CO2_molefraction_top_of_window on the plot. May I know where am I wrong?

Besides the above question, but on the same subject, I want to know if there is any option where I can plot 4 dimensional plot just like the 3 dimensional plot which can be drawn using plot3?

  • 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-05-30T03:10:34+00:00Added an answer on May 30, 2026 at 3:10 am

    Just a note — you only need to do the xlabel ylabel zlabel commands once (outside the loop).

    Also:

    • is there any reason your matrices are 1x1x100 instead of just 100x1 or 1x100?
      Because if you reshape them to 2D you can just do the plotting in one hit.
    • What do you mean by “missing third axis”? When I run your code (or as close as I can get, since you didn’t provide a reproducible example), I do get a 3rd axis:

    .

    X = rand(1,1,100); % 1x1x100 X matrix
    Y = rand(1,1,100); % 1x1x100 Y matrix
    Z = rand(1,1,100); % 1x1x100 Z matrix
    % Now, we could do a for loop and plot X(:,:,i), Y(:,:,i), Z(:,:,i),
    % OR we can just convert the matrix to a vector (since it's 1x1x100 anyway)
    %    and do the plotting in one go using 'squeeze' (see 'help squeeze').
    %    squeeze(X) converts it from 1x1x100 (3D matrix) to 100x1 (vector):
    plot3(squeeze(X),squeeze(Y),squeeze(Z),'o')
    xlabel('x')
    ylabel('y')
    zlabel('z')
    

    This gives the following, in which you can clearly see three axes:
    enter image description here

    If it’s the gridlines that you want to make the graph look “more 3D”, then try grid on (which is in the examples in the Matlab help file for plot3, try help plot3 from the Matlab prompt):

    grid on
    

    enter image description here

    You will have to clarify “missing third axis” a bit more.

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

Sidebar

Related Questions

I have three variables, all of the integers. indexA indexB indexC Now, using the
Once all three loads are complete... $(#sidebar a).live(click, function(e){ $(this).addClass(selected loading); $(#conceptual).load(conceptualUrl, null, function(){
I'm struggling with ambiguous type variables in typeclasses in Haskell: This code boils down
I have legacy ASP classic website. If I dump all the application variables using
Is there a way to clear all persistent variables in MATLAB functions, while keeping
In Ruby is there any method that lists all the global variables available at
I've inherited a project where all the private variables, and there are thousands, are
In Visual Studio 2008, is there a way of finding all the variables that
I've used all three of these when making local programmatic connections to databases. Is
I know that technically all three ways below are valid, but is there any

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.