I have two curves stored in the workspace. I use exactly the same commands to plot them:
newred = [0.8500 0.3250 0.0980];
subplot(1,2,1)
plot(gridd(1:ind), likk(1:ind),'color', newred, 'linewidth', 3)
subplot(1,2,2)
plot(x, approx,'color', newred, 'linewidth', 3)
the result is the following (9.1.0.441655 (R2016b))
They look different. This also happen with any other color that I choose. There will be difference in color between the two and the second will have the tiny white spots on the line.
What am i missing here?

댓글 수: 3

Mohamed Abdalmoaty
Mohamed Abdalmoaty 2017년 5월 27일
It appears to be something related to how many points are plotted!
Walter Roberson
Walter Roberson 2017년 5월 27일
Can you attach your data?
Mohamed Abdalmoaty
Mohamed Abdalmoaty 2017년 5월 27일
Sure.

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

 채택된 답변

Walter Roberson
Walter Roberson 2017년 5월 27일

2 개 추천

It appears to be caused by anti-aliasing.
set(gcf,'GraphicsSmoothing','off')
and the problem will go away (but the line will not be as smooth.)

댓글 수: 4

Walter Roberson
Walter Roberson 2017년 5월 27일
Note: I am using OS-X El Capitan: that might make a difference.
Mohamed Abdalmoaty
Mohamed Abdalmoaty 2017년 5월 28일
Thanks. I'm on Windows 7, and setting graphics smoothing off solves the issue. However, as you mentioned, the line is not smooth anymore. In any case, I reduced the number of points to be plotted and then the issue is not there anymore.
Walter Roberson
Walter Roberson 2017년 5월 29일
I just filed a bug report about this
Andy
Andy 2017년 5월 31일
Thank you for filing the bug report.
As a workaround, it may help to increase the line width a bit. I was able to get rid of the white artifacts by setting the line width to 6, but it may be dependent on the resolution of your display.
andy

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

추가 답변 (1개)

John D'Errico
John D'Errico 2017년 5월 27일
편집: John D'Errico 2017년 5월 27일

1 개 추천

You already know the reason! It is due to the number of dots plotted.
Each dot has a white center, a lower case o. Only the perimeter of the dot has any color. If you have only a few dots, then you see the white centers. If there are so many dots that they overlap and cover the centers of the neighboring dots, then all you see is red.
If you mi white and red, the color appears a bit washed out. So the sparse line tends to look a bit closer to a pastel.

댓글 수: 3

Mohamed Abdalmoaty
Mohamed Abdalmoaty 2017년 5월 27일
편집: Mohamed Abdalmoaty 2017년 5월 27일
I'm not using any markers and solid line by default. the plot on the right is a long vector. The one that looks nice on the left is a short one (so it is opposite of what you said).
John D'Errico
John D'Errico 2017년 5월 27일
The arrays in the .mat file are not in fact what you plotted. Different variable names. In fact, the curves are not exactly what you show in the plot you posted.
When I try to plot the two curves in the .mat file, in fact, I see no difference in color, but that is also in the current MATLAB release.
So you can claim what you wish, but I've seen far too often that people make claims about what they think they did and what they really did.
Mohamed Abdalmoaty
Mohamed Abdalmoaty 2017년 5월 27일
If you don't understand or see the problem, I don't know why you should write an answer.
See Walter's answer if you want to know the solution.

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

카테고리

제품

질문:

2017년 5월 26일

댓글:

2017년 5월 31일

Community Treasure Hunt

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

Start Hunting!

Translated by