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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T16:46:21+00:00 2026-05-27T16:46:21+00:00

Suppose one would like to plot 2 sets of data with unequal number of

  • 0

Suppose one would like to plot 2 sets of data with unequal number of elements

X=[1.1 1.4 1.2 1.1];
Y=[1.4 1.4 1.1]; 

I can use boxplot

boxplot([X Y],[1 1 1 1 2 2 2]) 

to plot these, however
there is no function like this for bar. i.e. I would like to plot
the bars for each value of X and each value of Y but the values
in X should cluster together and should be away from the bars in Y.
Ideally In addition to the group, one would also like to specify a third parameter
which would specify where on the x-axis should the bars be centred (say in my case [2 11]– one value for each group).

Does anyone have such a function?
I’ve checked matlabcentral and haven’t found what I’m looking for.
thanks
L

  • 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-27T16:46:21+00:00Added an answer on May 27, 2026 at 4:46 pm

    Something like this?

    X=[1.1 1.4 1.2 1.1];
    Y=[1.4 1.4 1.1];
    a = [2 11] - 1;
    
    bar((1:numel(X))+a(1), X, 'b')
    hold on
    bar((1:numel(Y))+a(2), Y, 'r')
    hold off
    set(gca,'XTickMode','auto')
    legend({'X','Y'})
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Suppose I have a table that contains valid data. I would like to modify
Suppose we would like to store pairs as elements in a list, e.g., >
Suppose we have a DAG with one source. I would like to find nodes
Suppose I have a string like this: one two three four five six seven
Suppose both parent and child use one pipe for writing and reading means when
Suppose I have a date 2010-07-29. Now I would like to check the result
Suppose I have a data frame, df, that looks like: f t1 t2 t3
I would like to submit a collection of entities one at a time. There
Suppose i have a List<Integer> l = new ArrayList<Integer>(); and would like to have
I have a simple rich:panel . I would like it to behave like one

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.