2d plot problem
2 views (last 30 days)
Show older comments
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 Comments
Answers (1)
Walter Roberson
on 8 Mar 2021
You need to use separate plots (at least for third). The disadvantage is that it becomes more difficult to track relative values.
See Also
Categories
Find more on Subplots in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!