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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 4, 20262026-06-04T19:27:40+00:00 2026-06-04T19:27:40+00:00

I am having trouble figuring out how display 4 variables in my plot. I

  • 0

I am having trouble figuring out how display 4 variables in my plot.

I want to vary the independent variables X,V, to produce the dependent variables Y and Z.
Y is a function of X AND V. And Z is a function of Y AND X.

This may be easier to see the dependencies: X, V, Y(X,V), Z(X,Y(X,V)).

I have used the surf function to plot X,Y,Z, but I also want to know the values of V, which I cannot currently ascertain.

Here is some test data to illustrate:

X = linspace(1,5,5)
V = linspace(1,5,5)
Capture = []
for j = 1:length(V)
Y = X.*V(j)
Capture = [Capture;Y]
end
[X,V] = meshgrid(X,V);
Z = Capture.*X
surf(X,Y,Z)

If I use the data cursor, I can see values of X,Y,Z, but I would also like to know the values of V. I know that the way I have it set up is correct because if I make two plots, say:

surf(X,Y,Z)
surf(X,V,Z) 

and then use the data cursor to go on the same point of X and Z for both graphs the values for V and Y are what they should be for that point (X,Z).

Is there anyway to show the values for X,Y,V and Z without having to generate two separate graphs?

Thanks!

  • 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-04T19:27:41+00:00Added an answer on June 4, 2026 at 7:27 pm

    Using color as your 4th dimension is a possibility (whether it looks good to you is a matter of taste).

    surf(X,Y,Z,V); #% 4th arg (V) is mapped onto the current colormap
    

    You can change the colormap to suit your tastes.

    colorbar #% displays a colorbar legend showing the value-color mapping
    

    Edit: The questioner wants to see exactly the data in the not-shown array, rather than just a color. This is a job for custom data cursor function. Below I’ve implemented this using purely anonymous functions; doing it within a function file would be slightly more straightforward.

    #% Step 0: create a function to index into an array...
    #% returned by 'get' all in one step  
    #% The find(ismember... bit is so it returns an empty matrix...
    #% if the index is out of bounds (if/else statements don't work...
    #% in anonymous functions)
    getel = @(x,i) x(find(ismember(1:numel(x),i)));
    
    #% Step 1: create a custom data cursor function that takes...
    #% the additional matrix as a parameter
    myfunc = @(obj,event_obj,data) {...
    ['X: ' num2str(getel(get(event_obj,'position'),1))],...
    ['Y: ' num2str(getel(get(event_obj,'position'),2))],...
    ['Z: ' num2str(getel(get(event_obj,'position'),3))],...
    ['V: ' num2str(getel(data,get(event_obj,'dataindex')))] };
    
    #% Step 2: get a handle to the datacursormode object for the figure
    dcm_obj = datacursormode(gcf);
    
    #% Step 3: enable the object
    set(dcm_obj,'enable','on')
    
    #% Step 4: set the custom function as the updatefcn, and give it the extra...
    #% data to be displayed
    set(dcm_obj,'UpdateFcn',{myfunc,V})
    

    Now the tooltip should display the extra data. Note that if you change the data in the plot, you’ll need to repeat Step 4 to pass the new data into the function.

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

Sidebar

Related Questions

I've been having a lot of trouble figuring this out. What I want is
I am having trouble figuring out how to override a rb_ function (like rb_ivar_get)
I'm new to rails and having trouble figuring out how to do this RESTfully.
I’m having a little trouble figuring this one out. I’m fairly new to C#,
I'm having trouble figuring out how to display some return JSON objects. My script
I'm having trouble figuring out this query. I'm using PHP and postgresql 9.1. I
I am having trouble figuring out how this is done in android. It is
So I am in a Linux course and having trouble figuring out this question.
This should be easy, but I'm having trouble figuring out how to zoom an
I'm having a little bit of trouble figuring out the best way to display

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.