Rotating plot with multiple y-axis
26 visualizzazioni (ultimi 30 giorni)
Mostra commenti meno recenti
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.
0 Commenti
Risposte (4)
Sanskar
il 27 Giu 2023
Modificato: Sanskar
il 27 Giu 2023
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
0 Commenti
Kanishk Singhal
il 27 Giu 2023
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])
Angelo Yeo
il 27 Giu 2023
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
il 16 Nov 2023
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...
0 Commenti
Vedere anche
Categorie
Scopri di più su Specifying Target for Graphics Output in Help Center e File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!