How to have smaller histogram show up on top of larger histogram

3 views (last 30 days)
I have code that currently plots several histograms on the same figure, but when the first histogram created is smaller than the next one, it becomes completely covered. Is there a way to make it so that the smallest histogram always shows up in the foreground?

Answers (1)

Image Analyst
Image Analyst on 21 Feb 2022
How are you plotting? Did you try
histogram(data1);
hold on;
grid on;
histogram(data2);
  3 Comments
Jeff Miller
Jeff Miller on 22 Feb 2022
maybe check the number of values in each dataset and plot the smallest one's histogram last?
Allen Borrow
Allen Borrow on 23 Feb 2022
Edited: Allen Borrow on 23 Feb 2022
That would work, but is there a way to make it so that no matter what order they are plotted in, the smallest one can still be on top? For the application I am using this code for, it would be helpful if order didn't matter

Sign in to comment.

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!