multiple y axes, one x axis
이전 댓글 표시
Hello, I want to know how to do three y axis one next to one on left side with space.. My function and i want it that is everything on left side on y axis.
clc
clear all
close all
x=[5.93 5.65 4.91 4.28 3.77 3.25];
y1=[10.72 10.15 8.76 7.61 6.68 5.76];
y2=[62.5 50 41.25 31.25 25 17.5];
y3=[4.661 4.413 3.809 3.309 2.904 2.504];
figure;
ax1 = gca;
get(ax1,'Position')
pos_ax1 = get(ax1,'Position');
set(ax1,'XColor','k',...
'YColor','b',...
'YLim',[0,12],...
'YTick',[0:1:12]);
ylabel('U_1_K [V]')
xlabel('I_1_K [A]')
line(x, y1, 'Color', 'b', 'LineStyle', '-', 'Marker', '.', 'Parent', ax1)
grid on
ax2 = axes('Position',get(ax1,'Position'),...
'XAxisLocation','bottom',...
'YAxisLocation','left',...
'Color','none',...
'XColor','k',...
'YColor','r',...
'YLim',[0,70],...
'YTick',[0:5:70],...
'XTick',[],'XTickLabel',[]);
ylabel('P_1_K [W]')
pos_ax2=pos_ax1-1;
line(x, y2, 'Color', 'r', 'LineStyle', '-', 'Marker', '.', 'Parent', ax2)
ax3 = axes('Position',get(ax1,'Position'),...
'XAxisLocation','bottom',...
'YAxisLocation','right',...
'Color','none',...
'XColor','k',...
'YColor','magenta',...
'YLim',[0,5],...
'YTick',[0:0.5:5],...
'XTick',[],'XTickLabel',[]);
ylabel('u_K [%]')
line(x, y3, 'Color', 'g', 'LineStyle', '-', 'Marker', '.', 'Parent', ax3)
title('Prikaz merilnih rezultatov')
%
%figure 2
I_n = 5.435;
U_1_k=interp1(x,y1,I_n)
P_1_k=interp1(x,y2,I_n)
Thanks :)
채택된 답변
추가 답변 (1개)
Image Analyst
2014년 1월 19일
0 개 추천
Adapt this code supplied by the Laura at Mathworks: http://www.mathworks.com/matlabcentral/fileexchange/39595-multiplotyyy
댓글 수: 4
Azzi Abdelmalek
2014년 1월 19일
androSLO commented
Where to adapt this code into it cause it doesn't work..
Azzi Abdelmalek
2014년 1월 19일
androSLO, I've deleted your answer, and posted it above, because it's supposed to be a comment, not an answer. To add a comment just click on: comment on this answer
androSLO
2014년 1월 19일
Image Analyst
2014년 1월 19일
Put it there somewhere between the first line and the last line. I think you're a smart enough engineer to figure it out. Sorry but I don't know the details of her code, and don't have the time to do it all for you.
카테고리
도움말 센터 및 File Exchange에서 Graphics Performance에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!


