How to use string cells as marker types?

scatter([1],[1],20,'filled','o');
is working, but the following not:
markers = {'o','s','d'};
scatter([1],[1],20,'filled',markers{1});
Why? How to fix this?

2 件のコメント

Thorsten
Thorsten 2015 年 9 月 24 日
What exactly do you mean by "it is not working"? I can get different markers with this command.
Subhra Saha
Subhra Saha 2015 年 9 月 28 日
編集済み: per isakson 2015 年 9 月 28 日
Mr. M,
I tried the following code snippet and it produces a plot with a marker.
markers = {'o','s','d'};
scatter([1],[1],20,'filled',markers{1});
It will be helpful to know what is the result that you are expecting and also the MATLAB release that you are using.

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

回答 (1 件)

Walter Roberson
Walter Roberson 2015 年 9 月 28 日

0 投票

Your code hints that you might be trying to use different markers for different points within one scatter() call, such as if you had done
scatter(rand(1,3),rand(1,3),20,'filled',markers);
hoping that the first point would use the first marker, the second point would use the second marker, and so on.
Any one call to scatter() can only use a single marker type. This is a restriction on scatter(). You can change the marker size for each point and you can change the marker color for each point, but you can only use a single marker type per call.

1 件のコメント

Royi Avital
Royi Avital 2018 年 5 月 22 日
I wish `scatter()` supported list of Markers like in MatPlotLib.

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

カテゴリ

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

質問済み:

2015 年 9 月 24 日

コメント済み:

2018 年 5 月 22 日

Community Treasure Hunt

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

Start Hunting!

Translated by