Most dual axis functions take the data to be plot as arguments, thus, losing the flexibility given by existing plotting functions. Moreover, they are not suited for Black/White printing.
Fancy DualGraphs separates the dual-axis feature, from plotting, so you can keep using your plotting tools and options, but in a dual axis fashion. Moreover, it has the option of adding elliptical markers onto data, pointing to the proper axis. This improves the readibility, mainly in B/W prints.
The horizontal position of the markers, as well as their size, are configurable in a simple and documented fashion.
The code of the screenshot is as simple as follows
[ax] = dualCreate();
% Left axis
plot(ax(1), x, y1)
% Right axis
plot(ax(2), x, y2,'g')
plot(ax(2), x, y3,'r')
% Figure parameters
legend('Line 1','Line 2','Line 3')
% Finalize graph
dualFinalize(ax, [0.2 0.8], 0.1,[1 -1]);
% Some makeup
If you have any suggestions or bug reports, please let me know!
Frequency Domain (2022). Fancy DualGraphs (https://www.mathworks.com/matlabcentral/fileexchange/36324-fancy-dualgraphs), MATLAB Central File Exchange. Retrieved .
MATLAB Release Compatibility
Platform CompatibilityWindows macOS Linux
Inspired by: Draw two figures with separate x and y axis
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!Start Hunting!