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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T09:38:46+00:00 2026-05-24T09:38:46+00:00

How to plot something outside the axis with MATLAB? I had like to plot

  • 0

How to plot something outside the axis with MATLAB? I had like to plot something similar to this figure;

Plot with bar outside axis

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-05-24T09:38:47+00:00Added an answer on May 24, 2026 at 9:38 am

    Here is one possible trick by using two axes:

    %# plot data as usual
    x = randn(1000,1);
    [count bin] = hist(x,50);
    figure, bar(bin,count,'hist')
    hAx1 = gca;
    
    %# create a second axis as copy of first (without its content), 
    %# reduce its size, and set limits accordingly
    hAx2 = copyobj(hAx1,gcf);
    set(hAx2, 'Position',get(hAx1,'Position').*[1 1 1 0.9], ...
        'XLimMode','manual', 'YLimMode','manual', ...
        'YLim',get(hAx1,'YLim').*[1 0.9])
    delete(get(hAx2,'Children'))
    
    %# hide first axis, and adjust Z-order
    axis(hAx1,'off')
    uistack(hAx1,'top')
    
    %# add title and labels
    title(hAx2,'Title')
    xlabel(hAx2, 'Frequency'), ylabel(hAx2, 'Mag')
    

    and here is the plot before and after:

    before_screenshot
    after_screenshot

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

Sidebar

Related Questions

Consider something like figure plot(sin(0:0.01:pi)) axis tight set(gca,'box','on','ticklength',[0.02 0.05]) then export the graph to
I am doing something like this: a = [1:100]; for i=1:100, plot([1:i], a(1:i)); end
I'd like to plot numerical data against non numerical data, say something like this:
I am curious how to plot function that is defined something like this: if(x
I plot a single trace in MATLAB with plot() . I'd like to add
Usually when I plot in MATLAB , it always draws on the same figure.
I'd like to show an image and plot something on it and then save
My input to gnuplot looks something like this: 1:00am 1 10 1:00am 30 12
I'm using MATLAB to plot some data. I would like to create the legend
I am trying to do a plot in Mathematica of something like x^2 +

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.