Problems in Plotting Line Plots with Overlapping Segments

조회 수: 17 (최근 30일)
Adnan
Adnan 2014년 7월 12일
댓글: Image Analyst 2014년 7월 13일
I am trying to draw Probability of Handover Failure vs. Velocity of Mobile Terminal. The issue is that i am getting two overlapping Line Plots on Probability (0.02) along Y axis. Actually, one Line Plot is exactly on 0.02, while the other is just above 0.02, but they appear quite identical.
Can anyone guide me that how to make the difference among the two visible?
Check this eclipse area

답변 (2개)

Image Analyst
Image Analyst 2014년 7월 12일
Try
plot(x,y, 'y-', 'LineWidth', 5); % Really wide solid yellow line underneath
hold on;
plot(x, y2, 'b--', 'LineWidth', 2); % Narrower, dashed blue line on top.
  댓글 수: 4
Adnan
Adnan 2014년 7월 12일
편집: Adnan 2014년 7월 13일
Image Analyst, here is the revised form. Actually, i am more interested to see that this yellow plot lies exactly at what value of Y axis. Like the black dotted line would be at 0.02. So, the yellow would be around what?
Is it related to scaling?
Image Analyst
Image Analyst 2014년 7월 13일
Yes it's related to scaling. Get rid of the blue and green lines and you should be better able to distinguish between the lines that are around 0.02.

댓글을 달려면 로그인하십시오.


Star Strider
Star Strider 2014년 7월 12일
There are several options. For instance, having one dashed and the other solid (or other variations) is easy using the LineSpec property of plot.
  댓글 수: 3
Adnan
Adnan 2014년 7월 12일
편집: Image Analyst 2014년 7월 12일
Thanks Star Rider. I have tried these Line Spec approaches, but they really seemed to be jumbled up. Any specific approach for scaling wherein this could be resolved?
Star Strider, how to use the subplot command?
Star Strider
Star Strider 2014년 7월 12일
편집: Star Strider 2014년 7월 12일
I’m a bit lost. Unless the yellow and dotted blue lines are supposed to be constant, the subplot approach would be:
figure(1)
subplot(2,1,1)
plot(x1,y1, '-b', x2,y2, '-g')
grid
subplot(2,1,2)
plot(x3,y3, '-y', x4,y4, '--b')
grid
This would plot two subplots, one above the other. It looks as though they all share approximately the same x-values, so the x-axis scales in both plots would be the same, but the y-axis scales would be appropriately different.
I don’t know your variable names, so the top subplot would, for example, plot the two variables currently plotted in blue and green, going from zero to about 0.12 and 0.15. The second subplot would plot the variables currently plotted in a thick yellow line and a dotted blue line, in the figure you posted at a y-value of about 0.02. If they are not constant at that value, the y-scale in the lower subplot will reflect their ranges. They would both be plotted in the same figure window, but not in the same plot.

댓글을 달려면 로그인하십시오.

카테고리

Help CenterFile Exchange에서 Line Plots에 대해 자세히 알아보기

태그

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by