필터 지우기
필터 지우기

Why does the marker size change randomly?

조회 수: 2 (최근 30일)
Anna
Anna 2014년 8월 6일
댓글: Sara 2014년 8월 6일
I have created a function which generates a random array of 1000 white dots
function RandomArray
%generate random points for X and Y coordinates of the points
X1 = rand(1000,1);
Y1 = rand(1000,1);
% Create axes
axes1 = axes('Color',[0 0 0]);
hold(axes1,'all');
% Create scatter
H = plot(X1,Y1,'MarkerFaceColor',[1 1 1],'MarkerEdgeColor',[1 1 1],...
'MarkerSize',2,...
'Marker','o',...
'LineStyle','none');
end
As you can see, there is no figure created as part of the function. This means that whenever I type "RandomArray" into the command window, the current figure is used. I have found that when I type RandomArray once, twice and then three times, on the third time, the marker size suddenly decreases, and then remains smaller if I continue to repeat the function. This does not occur when a new figure is created each time as part of the function. Please could someone tell me why this might be? Thanks
  댓글 수: 1
Sara
Sara 2014년 8월 6일
If you change the marker type to square, it won't change size with iteration...but I don't know why.
In another answer someone posted: "The circle marker size appears to be the number of points in the diameter. For the other markers, it is not so clear." (<http://www.mathworks.com/matlabcentral/answers/44917-how-is-the-markersize-of-a-circle-marker-defined>)

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

채택된 답변

Supreeth Subbaraya
Supreeth Subbaraya 2014년 8월 6일
This is happening because your renderer is changing from painters to zbuffer. You can check this by putting the following line in your code and debugging.
get(gcf,'renderer')
You can find more information about the renderers here. You can set the renderer by using the command,
set(gcf,'renderer','painters');
You can now see that the marker size would not change randomly.
  댓글 수: 1
Sara
Sara 2014년 8월 6일
Is there any advantage in using a different renderer?

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

추가 답변 (0개)

카테고리

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

태그

Community Treasure Hunt

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

Start Hunting!

Translated by