The thickness of border lines on a plot (different than that of the inner lines)
조회 수: 12 (최근 30일)
이전 댓글 표시
Dear All,
I was wondering why the thickness of the border lines on my simple grid plot are different on the left and top corners (than right and bottom) and they are all thinner than the inner lines with the following code in which I set the thickness the same for all (set(Z, 'LineWidth', 3)). I would so much appreciate your comments:
PS: Please note that the crowded "Z=..." bit on the code is just to define the lines and the fixation spot.
set(gcf,'doublebuffer','on');
set(gcf,'units','normalized','outerposition',[0 0 1 1]);
set(gcf,'Color',[1 1 1]);
k=1;
rannum1(1)=0;
rannum2(1)=0;
x_min=0; x_max=600; y_min=0; y_max=600;
%r=topleft corner point, s=topright corner, m=bottomleft corner,
%n=bottomright corner
r=[0 600]; s=[600 600]; m= [0 0]; n= [600 0];
Z=plot([r(1) s(1)], [r(2), s(2)] , '-black', [r(1) m(1)], [r(2), m(2)] , '-black', [m(1) n(1)], [m(2), n(2)] , '-black', [s(1) n(1)], [s(2), n(2)] , '-black', [(r(1)+s(1))/2 (((r(1)+s(1)+m(1)+n(1))/4)+rannum1(k))], [(r(2)+s(2))/2 (((r(2)+s(2)+m(2)+n(2))/4)+rannum2(k))], '-black', [(((r(1)+s(1)+m(1)+n(1))/4)+rannum1(k)) (m(1)+n(1))/2], [(((r(2)+s(2)+m(2)+n(2))/4)+rannum2(k)) (m(2)+n(2))/2], '-black', [(r(1)+m(1))/2 (((r(1)+s(1)+m(1)+n(1))/4)+rannum1(k))], [(r(2)+m(2))/2 (((r(2)+s(2)+m(2)+n(2))/4)+rannum2(k))] , '-black', [(((r(1)+s(1)+m(1)+n(1))/4)+rannum1(k)) (s(1)+n(1))/2], [(((r(2)+s(2)+m(2)+n(2))/4)+rannum2(k)) (s(2)+n(2))/2], '-black', 300, 300, 'o', 'MarkerEdgeColor','none','MarkerFaceColor','r', 'MarkerSize',12);
set(Z, 'LineWidth', 3);
axis([x_min x_max y_min y_max]);
axis square
axis off
set(gca, 'visible', 'off', 'units', 'normalized', 'position', [0.200 0.230 0.60 0.60]);
Thank you very much!
inci
댓글 수: 0
답변 (1개)
Sebastian Holmqvist
2012년 8월 9일
편집: Sebastian Holmqvist
2012년 8월 9일
I found that the figure automatically chooses the renderer ZBuffer, which is the cause of your display issues. I can't answer as to why it's not rendering properly, but manually setting the renderer to either 'Painter' or 'OpenGL' does the trick!
set(gcf, 'renderer', 'opengl')
or
set(gcf, 'renderer', 'painter')
댓글 수: 2
Sebastian Holmqvist
2012년 8월 9일
This is because of the different way each renderer draws the picture.
"OpenGL and Zbuffer renderers display objects sorted in front to back order, as seen on the monitor, and lines always draw in front of faces when at the same location on the plane of the monitor. Painters sorts by child order (order specified)."
So try plotting the center in a separate plot, or earlier in your current plot-spec.
참고 항목
카테고리
Help Center 및 File Exchange에서 Graphics Performance에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!