Setting different line colors according to the ColorOrder array using pzplot in subplots

I am running a for-loop where I form an ss()-object at each iteration. I then use subplot to show the pzplot of each system. This is working fine with the following:
for k = 1:4
...
figure(1)
subplot(2,2,k);
pzplot(SYS(:,:,k));
sgrid
end
Of course, all the subplots use the standard blue color. I would like them to progress through the ax.ColorOrder array as if I was plotting everything in one plot using hold. However, the only way I have successfully managed to change the color of a pzplot is using:
pzplot(SYS(:,:,k),'r');
I don't know how to switch from the 'r'-syntax to the [1 0 0] which is in the ax.ColorOrder array.
Any help is appreciated, thanks!

回答 (2 件)

Image Analyst
Image Analyst 2015 年 9 月 3 日

0 投票

See my attached color order demo. It does that.

5 件のコメント

Jesper
Jesper 2015 年 9 月 3 日
編集済み: Jesper 2015 年 9 月 3 日
I don't believe your script does what I'm looking for. In your script you change the ColorOrder for the next subplot, but in your case you have multiple data sets to plot on each subplot.
My issue is that I only plot one data set on each subplot and I would like the next subplot to choose the next color of the ColorOrder.
Further, pzplot does not have the same properties as the standard plot.
I don't use pzplot. I use plot() because it gives you the most control over how you want your plots to look. In plot() you can specify the line color with the color option and any 3 element array of RGB value in the range 0-1, like
plot(x, y, 'Color', [0.1, 0.25, 0.8]);
or whatever color you want.
Jesper
Jesper 2015 年 9 月 3 日
Yes, I totally agree that plot() is the one that provides the most freedom for customization but the plots I need are pole-zero maps so I use pzplot() (or pzmap(), it doesn't make a difference).
I will give it to you, that your script is nice for plot() customization, but that is unfortunately not what I'm looking for.
Image Analyst
Image Analyst 2015 年 9 月 3 日
Sorry. If anyone else uses pzplot, then hopefully they'll see your question and give you an answer that works. I'm not sure how commonly used it is though, but good luck.
Jesper
Jesper 2015 年 9 月 4 日
I'm not too hopeful either, but thanks.

サインインしてコメントする。

10 years later, you can now do this via the pzplot chart API.
Here is a demo showing how you can set a custom color order for a single pzplot:
h = pzplot(rss(3),rss(3),rss(3),rss(3)); %Create chart with 4 systems
h.ColorOrder = [1 0 0;0 1 0;0 0 1]; %repeat red, green, blue (4th system is also red)
h.Legend.Visible = "on"; %Show legend
Here is a demo showing how you can set the series index value across mulitple pzplots:
f = figure(); %Create new figure
t = tiledlayout(f,"flow"); %Create a flow layout
for ii = 1:4
h = pzplot(t,rss(3)); %Create new chart in layout
h.Layout.Tile = ii; %Place in new tile
h.Responses(1).SeriesIndex = ii; %Assign response next series index
end
Warning: Graphics acceleration hardware is unavailable. Graphics quality and performance might be diminished. See MATLAB System Requirements.

カテゴリ

ヘルプ センター および File ExchangeGraphics Performance についてさらに検索

タグ

質問済み:

2015 年 9 月 3 日

回答済み:

2026 年 6 月 1 日

Community Treasure Hunt

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

Start Hunting!

Translated by