Subplot with colormap color
1 次查看(过去 30 天)
显示 更早的评论
Hello,
I have a cell of 35 arrays. I want to plot them on 5 subplot, namely
```
subplot(1,5,1)-subplot(1,5,5)
```
each subplot has 7 of the arrays in the following order (with a span of 35/5=7)
```
subplot(1,5,1)
plot(M{1})
hold on
plot(M{8})
...
subplot(1,5,2)
plot(M{2})
hold on
plot(M{9})
...
subplot(1,5,3)
plot(M{3})
hold on
plot(M{10})
etc
```
Also, in each subplot I would like to have a colormap for hsv(5), for example the first color(red) for hsv(5) is for all the plot in subplot(1,5,1).
Thank you
0 个评论
采纳的回答
Walter Roberson
2022-9-14
编辑:Walter Roberson
2022-9-14
cmap = hsv(5);
for K = 1 : 5
thiscolor = cmap(K,:);
subplot(1,5,K);
plot(M{K}, 'color', thiscolor);
if K <= 3
hold on
plot(M{K+7}, 'color', thiscolor);
hold off
end
end
2 个评论
Walter Roberson
2022-9-15
cmap = hsv(5);
for K = 1 : 5
thiscolor = cmap(K,:);
subplot(1,5,K);
for J = K:5:25
plot(M{J}, 'color', thiscolor);
hold on
end
hold off
xlim auto; ylim auto
end
更多回答(0 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Debugging and Analysis 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!