在Matlab中更改极坐标图的色彩映射?

时间:2016-09-21 19:55:04

标签: matlab plot colors polar-coordinates

我试图更改极坐标图的色彩图以获得更多颜色。默认的matlab色彩映射没有足够的颜色,因此它会重复,这会让观众感到困惑。

我写了一个简单的例子,说明了我要做的事情:

theta = linspace(0,6*pi);
rho1 = theta/10;
polarplot(theta,rho1)
hold on
for n = 1:15
    rho2 = theta/(12-n/5);
    polarplot(theta,rho2)
end
fig = gcf;
colormap(fig, hsv(16))
hold off

然而,当我运行这个时,我仍然得到相同的7种默认色图颜色。你如何强迫matlab使用特定的色图?enter image description here

1 个答案:

答案 0 :(得分:1)

theta = linspace(0,6*pi);
rho1 = theta/10;
c = colormap(hsv(16));
polarplot(theta,rho1,'color',c(1,:))
hold on
for n = 1:15
    rho2 = theta/(12-n/5);
    polarplot(theta,rho2,'color',c(n+1,:))
end
相关问题