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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 16, 20262026-05-16T14:55:33+00:00 2026-05-16T14:55:33+00:00

I have two two-by-n arrays, representing 2d-points. These two arrays are plotted in the

  • 0

I have two two-by-n arrays, representing 2d-points. These two arrays are plotted in the same figure, but in two different subplots. For every point in one of the arrays, there is a corresponding point i the other array. I want to show this correspondance by drawing a line from one of the subplots to the other subplot.

The solutions i have found are something like:

 ah=axes('position',[.2,.2,.6,.6],'visible','off'); % <- select your pos...
 line([.1,.9],[.1,.9],'parent',ah,'linewidth',5);

This plots a line in the coordinate system given by the axes call. In order for this to work for me i need a way to change coordinate system between the subplots system and the new system. Anybody know how this can be done?

Maybe there is different way of doing this. If so i would love to know.

  • 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-16T14:55:33+00:00Added an answer on May 16, 2026 at 2:55 pm

    First you have to convert axes coordinates to figure coordinates. Then you can use ANNOTATION function to draw lines in the figure.

    You can use Data space to figure units conversion (ds2nfu) submission on FileExchange.

    Here is a code example:

    % two 2x5 arrays with random data
    a1 = rand(2,5);
    a2 = rand(2,5);
    
    % two subplots
    subplot(211)
    scatter(a1(1,:),a1(2,:))
    % Convert axes coordinates to figure coordinates for 1st axes
    [xa1 ya1] = ds2nfu(a1(1,:),a1(2,:));
    
    
    subplot(212)
    scatter(a2(1,:),a2(2,:))
    % Convert axes coordinates to figure coordinates for 2nd axes
    [xa2 ya2] = ds2nfu(a2(1,:),a2(2,:));
    
    % draw the lines
    for k=1:numel(xa1)
        annotation('line',[xa1(k) xa2(k)],[ya1(k) ya2(k)],'color','r');
    end
    

    Make sure your data arrays are equal in size.

    Edit: The code above will do data conversion for a current axes. You can also do it for particular axes:

    hAx1 = subplot(211);
    % ...
    [xa1 ya1] = ds2nfu(hAx1, a1(1,:),a1(2,:));
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have two arrays. I'd like to copy ranges of data from one of
I have two arrays and I post the arrays in one input; <input name='sistem[]'
I have two arrays, the first one contents numbers and the second one use
I have two arrays, one is very large (more than million entries) and other
I have two arrays of different size A and B. I am comparing A
I have two arrays. One contains id=>count and the other contains id=>name . I'm
I have two arrays in C++ and I'd like to append one to the
I have two arrays. One looks like this: var array_one = [.a, .b, .c,
I have two arrays of animations, one a before animation and one an after
I have two arrays one with fake Japanese characters, another with the English alphabet

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.