フィルターのクリア

Customizing plots that are matrices of column vectors?

4 ビュー (過去 30 日間)
Gabriel
Gabriel 2024 年 9 月 9 日
回答済み: Star Strider 2024 年 9 月 9 日
Say I have a matrix CphNUM consisting of 2 collumn vectors, and I wish to scatter it along xNUM:
scatter(xNUM, CphNUM)
Is there any way that I can, without splitting the matrix into separate entries, change the markers independently? I'm aware I can just write:
scatter(xNUM, CphNUM(:, 1), "filled")
scatter(xNUM, CphNUM(:, 2), "filled", 'd')
I am just curious if I can do this without separating the matrix. I've been trying to read some other posts here as well as the documentation, but I haven't been able to find anything specific to plotting a matrix itself.
Thanks!

回答 (2 件)

Stephen23
Stephen23 2024 年 9 月 9 日
X = 1:9;
Y = rand(9,2);
S = scatter(X,Y);
set(S,{'Marker'},{'o';'*'})

Star Strider
Star Strider 2024 年 9 月 9 日
It is reelatively straightforward to change the markers (and other propeerties) after plotting.
Try something like this —
x = linspace(0, 10, 15).';
y = [cos(2*pi*x) sin(2*pi*x)];
figure
scatter(x, y, 'filled')
grid
title('Original')
figure
hsp = scatter(x, y, 'filled');
grid
hsp(1).Marker = 'd';
hsp(2).Marker = 'p';
title('Markers Changed After Plotting')
.

カテゴリ

Help Center および File ExchangeScatter Plots についてさらに検索

製品


リリース

R2022b

Community Treasure Hunt

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

Start Hunting!

Translated by