BarTwoYaxis
No License
plots a 2 axis bar plot by normalizing values to be from 0 to 1 on both data sets, plotting them as one grouped bargraph, adding 2nd y-axis and then modfying y axis ticks. bar1 & bar2 are column vectors.
If errors is not empty (Expected 2 row vector same size as numbars) than plot errorbars using errorbar function. Idea based on Bolu Ajiboye barweb code (though implemented differently)
Use:
figHandle = BarTwoYaxis(bar1,bar2,[],[],'','','',[])
Will plot a 2 Y axis grouped bar with the bar1 series using the left y axis and the bar2 series using the right one.
Type help BarTwoYaxis to see fuller argument list.
Cite As
Shai Shen-Orr (2026). BarTwoYaxis (https://se.mathworks.com/matlabcentral/fileexchange/10839-bartwoyaxis), MATLAB Central File Exchange. Retrieved .
MATLAB Release Compatibility
Platform Compatibility
Windows macOS LinuxCategories
- MATLAB > Graphics > 2-D and 3-D Plots > Data Distribution Plots > Histograms >
- MATLAB > Graphics > 2-D and 3-D Plots > Line Plots > Two y-axis >
Tags
Acknowledgements
Inspired by: barweb (BARgraph With Error Bars)
Discover Live Editor
Create scripts with code, output, and formatted text in a single executable document.
| Version | Published | Release Notes | |
|---|---|---|---|
| 1.0.0.0 |
