Rotating plot with multiple y-axis
이전 댓글 표시
Hello,
I'm trying to plot 3 graphs on a 4x4 tiledlayout. first graph is a plot placed in 1 row and 3 columns. Next is plot of 3 rows and 3 columns. Last plot is 3 row and 1 columns.
Although I can plot all the graphs correctly but I'm having problem woth orientation with the last plot. For the first and second plots no rotation is required but for the last plot I need it rotated by 90 degrees.
I'm using double Y-axis in all the plots so MATLAB is showing the following warning:
Warning: 3-D views not supported for axes with multiple coordinate systems.
Please suggest solution.
In plot 3, I have already tried interchanging x and y-axis but due to sclae difference between the two y-axis, the solution doesn't seem to be effective and thus right y-axis plot seems like a line compared to left y-axis.

답변 (4개)
Hi Mohit!
What I understand from your question is that you are trying to fir all three plot with third one rotated by 90 degree.
We can use rotate function to rotate by whatever degree you require. Following is the demo code:
figure;
x= 1:10;
tiledlayout(4, 4);
% First Plot
nexttile([1 4]);
h = plot( 2*x+3,x );
%Second Plot
nexttile([3 3]);
x = 1:100;
plot(x,y);
%Third Plot
nexttile([3 1]);
gca = plot(x,y);
%Rotating the third one
rotate(gca, [0 0 1], 90);
%here we are rotating about z-axis by 90 degree
Happy to help!
Sanskar
Kanishk Singhal
2023년 6월 27일
Is this is the figure you are looking for? The third plot is for sin(
) rotated clockwise 90deg.

This can be achieved with tiledlayout and view.
x = 0:0.01:7;
tiledlayout(4,4);
nexttile([1 3])
plot(x,sin(x))
nexttile(5, [3 3])
plot(x,cos(x))
nexttile(8, [3 1])
plot(x,sin(x.^2))
view([90 90])
Hi Mohit,
Swapping input arguments for x-axis and y-axis in plot swaps x and y axis. For example,
fs = 1000; t = 0:1/fs:2-1/fs;
x = cos(2*pi*1*t);
y = sin(2*pi*1*t);
fig = figure('position',[0, 0, 420, 420]);
ax1 = axes(fig, 'Position', [0.1, 0.75, 0.6, 0.2]);
plot(ax1, t, x);
ax2 = axes(fig, 'Position', [0.1, 0.1, 0.6, 0.6]);
plot(ax2, x, y);
ax3 = axes(fig, 'Position', [0.77, 0.1, 0.2, 0.6]);
plot(ax3, y, t); % see the t and y are swapped.
I don't acutally understand what you mean by
In plot 3, I have already tried interchanging x and y-axis but due to sclae difference between the two y-axis, the solution doesn't seem to be effective and thus right y-axis plot seems like a line compared to left y-axis.
A more detailed explanation is needed for a further help.
Sasha Kramer
2023년 11월 16일
0 개 추천
Has anyone managed to solve this problem? Mohit's original issue of not being able to rotate a yyaxis plot (specifically a multiple axis plot, giving the error: Warning: 3-D views not supported for axes with multiple coordinate systems) seems to still be an issue with none of the suggestions here providing a solution...
카테고리
도움말 센터 및 File Exchange에서 2-D and 3-D Plots에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!
