File Exchange

image thumbnail

Draw two figures with separate x and y axis

version 1.0 (2.23 KB) by

This script plots two sets of 1D data on the same figure.



View License

This script plots two sets of 1D data on the same figure with two separate axis and with the same gridding.
The code also checks if the x-axis data are the same, if the x-axis data
are not the same, it draws an additional x-axis on the top of the figure.
The two sets of data with their axes are drawn with two colors for ease of reading

Comments and Ratings (3)

almog shalom


Nassim Khaled

Nassim Khaled (view profile)

Hi Jan. Thanks for the constructive comment.You are right(in all of what you said). This function is very similar to plotyy, yet people are always asking about this, and for some reason, it is easier to find these files on Matlab central than Matlab help.

Jan Simon

Jan Simon (view profile)

"[0:.3:40]" is less efficient than "0:.3:40".
It might be helpful to mention Matlab's built-in PLOTYY in a "See also" line, because it does almost the same.

MATLAB Release
MATLAB 7.6 (R2008a)

Inspired: Fancy DualGraphs

Download apps, toolboxes, and other File Exchange content using Add-On Explorer in MATLAB.

» Watch video