File Exchange

image thumbnail


version (37.2 KB) by Scott Lowe
Have no fear. Superbar is here!


Updated 11 Nov 2016

From GitHub

View Version History

View license on GitHub

Bars! Bars! Bars!
Make bar charts rammed full of extra features:
- in full technicolor, with a unique colour for every bar if that's what you're into
- showing errors on the values using errorbars, with many styles available
- with statistical significance of each bar indicated with stars above them
- with statistical significance of comparisons between pairs of bars shown with lines between the pairs and stars above them
- and all this in either horizontal or vertical orientations
Have no fear. Superbar is here!
And that's not all! It comes with a free copy of SUPERERR, which you can use to plot error bars not on bar charts. Plot errors in both X and Y with lots of style options for capped, uncapped, one-directional, symmetric, asymmetric errorbars. It can do everything you want, just as long as what you want is to plot errorbars on a set of linear-linear axes!

If you want to help make SUPERBAR even more super, you can report bugs and suggest new features on GitHub:

Tested in R2011a (Windows) and R2016a (Windows & Ubuntu).

Cite As

Scott Lowe (2021). superbar (, GitHub. Retrieved .

Comments and Ratings (34)

Luca Rosalia

Absolutely fantastic - great work :)

Roger Mallol Parera

M. Khishe

Jae Moon

Excellent program! thank you. But I have a problem. I want to be able to exclude showing P Lines for comparisons that are not significant. How can I do that?

Hunter Pruett

just made a function called barmod--wanted to make sure that I wasn't reinventing the wheel, so I took some time to demo Scott Lowe's work here. Barmod is more for positioning and placement. If the functionality is useful to you, here's a link:

lc lc

Danyi su

Great!! Thank a lot!!!


Powerful and robust.

Merage Ghane


This function just saved my life. Being able to put error bars as well as the significance level stars above, is ideal. This is what people want for a publishable figure. Also, as the comments suggested, the legend colors can be fixed by doing ax(1,:) as a parameter. The customizability for this function is incredible.


Simone Di Plinio

Luis Montesinos

Nicholas Blauch

i found a workable solution. somehow the list of bar handles from superbar is transposed, such that legend operates along the first column of handles when what one wants for group-corresponding legend colors would be operating along the first row. set ax = superbar(...); when setting legend, use the first row of ax - that is, ax(1,:) - to set the subset for legend.

ax = superbar(...);

Nicholas Blauch

hi scott. this is great. my only issue is the one mentioned below: the legend colors do not come out correctly. for me, they typically come out all as the same color as the first bar group.

is there a workaround this issue, or is it a known bug?

Aaron Fleming

Craig Workman

Almost perfect. Only two things lacking. 1) ability to rename x-axis of grouped bars (i.e. Time 1, Time 2, Time 3) and 2) the legend colors don't match the bar colors of grouped bars.

Anton Semechko

Regarding the comment made inside ‘superbar’ by the author: “If you see boxes showing a rectangle with a cross through them instead of stars … “

I encountered this issue, but it is easily resolved. Simply set ‘string’ and ‘interpreter’ properties of HPT handles returned by ‘superbar’ to ‘\ast’ and ‘tex’, respectively.

Anton Semechko

This is one of the best plotting utilities on FEX. Thanks for sharing!


Hi Scott, how to plot upward errorbars for positive means, and downward errorbars for negative means at the same time?


Thanks for this - I'm finding it really useful!
One question - I'm making a grouped bar plot (ie two different bars for each value on the x axis), and I want the colors to be different for each group. I can't seem to figure out how to do this - no matter how I set the color matrix up with 'BarFaceColor,' it seems that the two bars for each x axis value are always the same color rather than a unique color for each group, as I want them to be. Can anyone help? Thanks!

Matthieu Komorowski

Thanks Scott for this great function! The lines for pairwise comparison don't work when using asymmetric error bars. I've added the following line at the beginning of the function 'plot_p_values_pairs', which does the trick:
if size(E,2)==2 ; E=E(:,2); end

Matthieu Komorowski

Zaki Molvi

Tsai-yu Shih




Aaaah this is exactly what I needed. It's so pretty and easy!
I've got one question though: I have plots where all values are negative - is there a way to make the main lines start at the zero point instead of the top of the highest bar? Or to put them below the bars? So that they're not overlapping with the bars themselves?

Matt Flood

This should replace the current 'bar' function supplied by Matlab.
Brilliant work!

Baptiste Le Mauff

Abby Hill

Scott Lowe

Hi Michael, I've added a 'BarLineWidth' input to SUPERBAR now, so you can change the width of the bar edges more easily, and the default width is wider than it used to be.
Thanks for your feedback!

Scott Lowe

Hi, Michael! I'm glad to hear you found superbar easy to set up and use, especially since the documentation isn't finished yet! It is currently not possible to pass arbitrary inputs to bar via superbar (though I do intend to add this at some point in the future). For the time being, you have to change the properties of the bars created by superbar using the first set of handles it returns. For example,
`h = superbar(Y, 'BarEdgeColor', 'k'); set(h, 'LineWidth', 2);`. Hope that helps!

Michael Bishop

Great tool! Had it up and integrated in couple minutes. One question: is there an easy way to control the line-thickness of bars?


Excellent! So many customizations. I've been waiting a long time for someone to do all this work for me.

MATLAB Release Compatibility
Created with R2011a
Compatible with any release
Platform Compatibility
Windows macOS Linux

Community Treasure Hunt

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

Start Hunting!