Strange rendering of colorbar when plotting lines in many colors

조회 수: 2 (최근 30일)
Tobias
Tobias 2013년 6월 7일
When plotting lines in many colors, the colorbar looks strange when the figure renderer is set to 'painters'.
The following code plots N lines with N colors according to colormap.
N=200;
colors=hsv(N);
t=2*pi*(0:N-1)/N;
c=cos(t);
s=sin(t);
figure(1);
clf
colormap(colors);
hold all;
set(gca,'ColorOrder',colors);
plot([zeros(1,length(t)); c],[zeros(1,length(t));s])
For me the colorbar looks normal if N<165. Greater values lead to strange rendering with a reduced color range and a sharp edge somewhere in the middle. Increasing N further leads to a black colorbar with no colors displayed at all.
However, when exporting the graph or changing the renderer to 'zbuffer' or 'opengl' the colorbar looks normal for all N.
How can I avoid this behavior except for manually changing the renderer for every figure?
  댓글 수: 2
Walter Roberson
Walter Roberson 2013년 6월 8일
Which OS and which MATLAB version?
Have you considered setting the root DefaultFigureRenderer property so that you do not code it for every figure?
Tobias
Tobias 2013년 6월 10일
Thanks for the reply and sorry for the late answer.
My Matlab Version is 8.0.0.783 (R2012b), OS is Win7. Thanks for the tip with the default renderer, this would be a solution. How do z-buffer and opengl renderer behave when exporting figures? Do they support vector graphics (eps, pdf)?

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

답변 (0개)

카테고리

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

태그

제품

Community Treasure Hunt

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

Start Hunting!

Translated by