myaxisc

Version 1.5.1 (37.6 KB) by vik
Create axes object with multiple y-axis in Figure or App Designer
989 Downloads
Updated 6 Feb 2019

View License

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.

Features:
- 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.

Cite As

vik (2024). myaxisc (https://www.mathworks.com/matlabcentral/fileexchange/70033-myaxisc), MATLAB Central File Exchange. Retrieved .

MATLAB Release Compatibility
Created with R2018b
Compatible with any release
Platform Compatibility
Windows macOS Linux
Categories
Find more on Develop Apps Using App Designer in Help Center and MATLAB Answers
Acknowledgements

Inspired by: plotyyy, ploty4.m, addaxis

Community Treasure Hunt

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

Start Hunting!
Version Published Release Notes
1.5.1

Updated Screenshot

1.5

Added zooming and panning functionality in App Designer, fixed and allowed single axis-dragging

1.4

Added position argument, deconstructor for manual deletion, fixed missing axestoolbar, more input arguments

1.3

Added more compatibility to App Designer, updated examples

1.2.1

Fixed zip-archive

1.2

Added MATLAB App Designer Compatibility

1.0.1

Fixed Pan-Button in axtoolbar

1.0.0