2d plot problem
조회 수: 2 (최근 30일)
이전 댓글 표시
I have imported from four excel files. (Please find attached files) I have plotted the datas in them as follows:
clear all;
W1=readtable('first.xlsx');
D1=table2array(W1);
y1 = D1(2:end,2);
x1=D1(1,2:end).';
%%%%%%%%%%%
W2=readtable('second.xlsx');
D2=table2array(W2);
y2 = D2(2:end,2);
x2=D2(1,2:end);
%%%%%%%%%%%
W3=readtable('third.xlsx');
D3=table2array(W3);
y3 = D3(2:end,2);
x3=D3(1,2:end).';
%%%%%%%%%%%
W4=readtable('forth.xlsx');
D4=table2array(W4);
y4 = D4(2:end,2);
x4=D4(1,2:end).';
%%%%%
figure (1);
p1=plot(x1,y1,"Marker","o","MarkerEdgeColor","none", "MarkerFaceColor","r","DisplayName","first");
xlabel('x') ;
ylabel('Error');
hold on;
p2=plot(x2,y2,"Marker","s","MarkerEdgeColor","none", "MarkerFaceColor","b","DisplayName","second");
hold on;
p3=plot(x3,y3,"Marker","v","MarkerEdgeColor","none", "MarkerFaceColor","m","DisplayName","third");
hold on;
p4=plot(x4,y4,"Marker","^","MarkerEdgeColor","none", "MarkerFaceColor","c","DisplayName","fourth");
legend([p4,p3,p2,p1],"Location","north")
After running the code, I get the following figure: (In the figure, some lines is very close to the line y=0)
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/543456/image.jpeg)
Then I added the following code
ylim([10^(-5) 10^(-3)])
I get the following picture. (But now the some part doesn' appear in the plot)
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/543461/image.jpeg)
How do we make the graphic visible and understandable? Nested plots or another solutions?
I am looking forward to your helps.
Any help would be appreciated.
댓글 수: 0
답변 (1개)
Walter Roberson
2021년 3월 8일
You need to use separate plots (at least for third). The disadvantage is that it becomes more difficult to track relative values.
참고 항목
카테고리
Help Center 및 File Exchange에서 Annotations에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!