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

  • Home
  • SEARCH
  • 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 6118157
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T15:24:13+00:00 2026-05-23T15:24:13+00:00

I’ve run into a bit of a hiccup trying to plot some data in

  • 0

I’ve run into a bit of a hiccup trying to plot some data in the way I want it – any advice would be greatly appreciated.

left and right are vectors of a few hundred thousand in length, obtained elsewhere.
The code below plots left, twice – the second plot lies on top of the first, roughly towards one corner.

ax1 = axes;
plot(ax1, left, 'b');
set(ax1, 'xlim', [7.075*10^4 7.5*10^4]);
set(ax1, 'ylim', [-0.02 0.02]);

ax2 = axes('Position', get(ax1,'Position'), 'XAxisLocation', 'top', 'YAxisLocation', 'right', 'Color', 'none', 'XColor', 'k', 'YColor', 'k', 'NextPlot', 'add');
plot(ax2, left, 'b');
set(ax2, 'Units', 'normalized', 'Position', [0.6 0.60 0.25 0.25]);

What I’d like to do is have the same kind of thing for right, and then display each pair of plots as a subplot, with the two subplots side by side. I’ve tried adapting the way I’m doing it above to use subplot, but I’m obviously doing something wrong since I keep on nuking the contents of each subplot and ending up with two empty subplots.

Also, is it possible to prevent the smaller inset plot from having a transparent background?

  • 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-23T15:24:13+00:00Added an answer on May 23, 2026 at 3:24 pm

    Consider the following example:

    %# sample data
    x = 1:100;
    left = randn(100,1);
    right = cumsum(rand(100,1)-0.5);
    
    %# build axes positions
    hBig = [subplot(121) subplot(122)];         %# create subplots
    posBig = get(hBig, 'Position');             %# record their positions
    delete(hBig)                                %# delete them
    posSmall{1} = [0.275 0.63 0.16 0.24];
    posSmall{2} = [0.717 0.63 0.16 0.24];
    
    %# create axes (big/small)
    hAxB(1) = axes('Position',posBig{1});
    hAxB(2) = axes('Position',posBig{2});
    hAxS(1) = axes('Position',posSmall{1});
    hAxS(2) = axes('Position',posSmall{2});
    
    %# plot
    plot(hAxB(1), x, left, 'b');
    plot(hAxB(2), x, right, 'b');
    plot(hAxS(1), x, left, 'r');
    plot(hAxS(2), x, right, 'r');
    
    %# set axes properties
    set(hAxB, 'XLim',[1 100], 'YLim',[-10 10]);
    set(hAxS , 'Color','none', 'XAxisLocation','top', 'YAxisLocation','right');
    

    screenshot

    If you want the background color of the smaller axes to be opaque, just set their colors to white:

    set(hAxS , 'Color','w')
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

link Im having trouble converting the html entites into html characters, (&# 8217;) i
I have some data like this: 1 2 3 4 5 9 2 6
I am currently running into a problem where an element is coming back from
this is what i have right now Drawing an RSS feed into the php,
I'm trying to decode HTML entries from here NYTimes.com and I cannot figure out
I have just tried to save a simple *.rtf file with some websites and
I want to count how many characters a certain string has in PHP, but
I'm parsing an RSS feed that has an ’ in it. SimpleXML turns this
I am trying to loop through a bunch of documents I have to put
i want to parse a xhtml file and display in UITableView. what is the

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.