Object orientated approach for creating plots with three or more y axis. myaxisc, short for "Multiple Y Axis Class", is a class holding all the axes objects needed to display multiple Y axis. Second axis is placed on the right side, the additional axes are placed on the left side.
- Creates axes with as much additional Y axis as you want (as long as there is enough space, minimum are 2 y axis).
- Works with MATLAB App Designer as well as in regular Matlab Figures and therefore also in programmatic created GUIs.
- Full working zoom and pan functionality in App Designer UIFigures (extra buttons required) and in regular Figures using axtoolbar.
- When zoom or pan is not active, single y-axis can be panned.
- Includes some easy to use basic methods to modify appearance: Labels, Limits, Colors, FontSize, Position
Two example files (myaxisc_example.m and myaxisc_app.mlapp) are included to demonstrate usage.
Usage in regular Figures: Create myaxisc-object "h" and call plot with specified axes to plot into:
h = myaxisc(4,0.1); % Create myaxisc-object "h" with 4 y axes and a spacing of 0.1
plot(h.p(3),x,y) % Create plot in third axes using method "p"
Usage in App Designer: Its recommended to create a container panel to put the axes into. Use startupFcn to then create the axes into the container panel. See the attached example file for details. You need to add some functions and properties and also implement the buttons by yourself.
Installation: Nothing special, just make sure the myaxisc.m-File is in path.
There is a lot of compatibility coded into the class so it should behave the same way in App Designer UIFigures as well as in regular Figures and programmatic created Apps. Even though zooming and panning methods are implemented completely different, they should behave the same way. Unfortunately it is still possible to drag single line objects sometimes in uifigure so panning may behave buggy.
vik (2021). myaxisc (https://www.mathworks.com/matlabcentral/fileexchange/70033-myaxisc), MATLAB Central File Exchange. Retrieved .
MATLAB Release Compatibility
Platform CompatibilityWindows macOS Linux
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!Start Hunting!