MATLAB: I need to reverse the X axis in a stacked plot graph. How to do that reverse x-axisstackedplot I ploted a X,Y stacked graphic stackedplot(X,Y) Best Answer That is not one of the options for the stackedplot function, although it is easy enough to do in code: x = linspace(0, 1); % Create Datay = sin(2*pi*x'*[1 5 7]) + exp(x'*[0.5 1.5 2.5]); % Create Datafigurestackedplot(x, y); % ‘Normal’ Plotfigurestackedplot(fliplr(x), y); % Use Appropriate ‘flip’ Function To Reverse The ‘X’-Axis DirectionNote that here, ‘x’ is a row vector and ‘y’ is a matrix of column vectors, so use the appropriate ‘flip’ function for the x-axis. . Experiment to get the result you want. Related SolutionsMATLAB: Deletting X and Y axes ticks set(gca,'xtick',[]) set(gca,'ytick',[]) MATLAB: How to flip the direction of the axis xticklabels([1:10]) %an example set ( gca, 'xdir', 'reverse' ) Related QuestionFontsize and properties of Xticklabels using figure handlesSpectrogram x axis logarithmicSet the Ticks only on the X and Y axisSwitching scales on x axisImproving readability of Matlab graphManipulating X-Axis Values
Best Answer