Reputation: 336
I'm trying to change the colormap of a polar plot in order to get more colors. The default matlab colormap doesn't have enough colors so it repeats and this gets confusing for viewers.
I wrote a simplified example of what I'm trying to do:
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
However when I run this I still get the same 7 default colormap colors. How do you force matlab to use a specific colormap?
Upvotes: 0
Views: 642
Reputation: 325
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
Upvotes: 1