Linestyles & Marker styles when plotting a matrix

How can I specify the markers and linestyles using the plot or semilogy commands when I am plotting a matrix? I understand how to use triplets (x,y,s) for plotting individual lines. How do I do the same when plotting plot(Y) where Y is a matrix? Including the 'marker' property in the plot command seems to apply the same marker to all lines. Thanks!

 採用された回答

Mike Garrity
Mike Garrity 2015 年 9 月 4 日

5 投票

It's hard to do that in the plot command, but the set command can do it:
h = plot(magic(3));
set(h,{'Marker'},{'+';'s';'o'})
The syntax is a little odd, isn't it? What's going on is that plot returned a 3x1 array of handles to line objects. The {} syntax to set says that I'm giving you a property name and an array of values, and I want you that property of each of the objects to the corresponding value.
Does that make sense?

3 件のコメント

Mark Archibald
Mark Archibald 2015 年 9 月 5 日
Many thanks -- that is exactly what I was looking for. I was using the wrong syntax. The curly braces did the trick!
luis
luis 2024 年 4 月 12 日
How do I get rid of the lines?
I am plotting matrices
Thank you in advance!!
Voss
Voss 2024 年 4 月 12 日
data = (1:10).'+(0:3);
plot(data,'s')

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

その他の回答 (0 件)

カテゴリ

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

質問済み:

2015 年 9 月 3 日

コメント済み:

2024 年 4 月 12 日

Community Treasure Hunt

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

Start Hunting!

Translated by