Plot binary matrix as dot
15 次查看(过去 30 天)
显示 更早的评论
Hi,
I have this matrix that indicates a location [0 0 0 0 1 0 1 1 0 0 1 0 0 0]. I want to plot the value of 1 from this matrix using dot as the marker. How can I do it?
Thanks.
采纳的回答
James Tursa
2015-6-25
Another way:
spy(sparse(x));
3 个评论
Leyla Elyasizad
2022-7-18
Does it work for big matrix?
I used it for a big matrix it seems that it is squeezing the figure
the cyclist
2022-7-21
When you say "squeezing", what do you mean?
My best guess is that perhaps the aspect ratio of the figure is not what you expect? You could do commands like axis square or axis equal, and see if that gives more like what you expect. (There are other options, as well.)
更多回答(2 个)
the cyclist
2015-6-25
编辑:the cyclist
2015-6-25
One guess at what you want. If this is not what you want, I suggest you add detailed explanation.
figure x = [0 0 0 0 1 0 1 1 0 0 1 0 0 0]; x(x==0) = NaN; % Changing the value of x. If you need it preserved, save to a new variable. h = plot(1:numel(x),x,'k.'); set(h,'MarkerSize',24) xlim([0.5 numel(x)+0.5])
0 个评论
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Discrete Data Plots 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!