发现一个画四个坐标轴的绘图函数,不敢独享~
function [ax,hlines] = ploty4(x1,y1,x2,y2,x3,y3,x4,y4,ylabels)
%PLOTY4 Extends plotyy to include a third and fourth y-axis
%
% Syntax: [ax,hlines] = ploty4(x1,y1,x2,y2,x3,y3,x4,y4,ylabels)
%
% Inputs: x1,y1 are the xdata and ydata for the first axes' line
% x2,y2 are the xdata and ydata for the second axes' line
% x3,y3 are the xdata and ydata for the third axes' line
% x4,y4 are the xdata and ydata for the fourth axes' line
% ylabels is a 4x1 cell array containing the ylabel strings (optional)
%
% Outputs: ax - 4x1 double array containing the axes' handles
% hlines - 4x1 double array containing the lines' handles
%
% Example:
% x = 0:10;
% y1=x; y2=x.^2; y3=x.^3; y4=x.^4;
% ylabels{1} = 'First y-label';
% ylabels{2} = 'Second y-label';
% ylabels{3} = 'Third y-label';
% ylabels{4} = 'Fourth y-label';
% [ax,hlines] = ploty4(x,y1,x,y2,x,y3,x,y4,ylabels);
% leghandle = legend(hlines, 'y = x','y = x^2','y = x^3','y = x^4',2);
%
% See also Plot, Plotyy