using plotyy for multiple plots
5 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
I have four plots, to be plotted in the same figure. Two plots are for a y-axis on the right hand side and two for the left hand side. for each pair, the x values are different. For example:
% Two plots for y at right axis
x1 = 0:10;
x2 = 0:5;
y1 = rand(1,11);
y2 = rand(1,6);
% Two plots for y at left axis
x3 = 0:10;
x4 = 0:5;
y3 = rand(1,11);
y4 = rand(1,6);
How can I plot them in a same figure with plotyy or any other command?
Thanks, :)
Soroush
0 comentarios
Respuestas (1)
Walter Roberson
el 16 de Jul. de 2015
ax = plotyy(x3, y3, x1, y1); %left then right
line(ax(1), x4, y4); %add another line to left axis
line(ax(2), x2, y2); %add another line to right axis
2 comentarios
Walter Roberson
el 16 de Jul. de 2015
ax = plotyy(x3, y3, x1, y1); %left then right
line(x4, y4, 'Parent', ax(1)); %add another line to left axis
line(x2, y2, 'Parent', ax(2)); %add another line to right axis
Ver también
Categorías
Más información sobre Two y-axis en Help Center y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!