フィルターのクリア

spy, making nodes more visible

6 ビュー (過去 30 日間)
Jan
Jan 2016 年 9 月 24 日
コメント済み: Jan 2016 年 9 月 26 日
How do I modify the Matlab command spy to have more visible (red) nodes of graphs? Say something like this THIS on page 7.
  3 件のコメント
John D'Errico
John D'Errico 2016 年 9 月 24 日
編集済み: John D'Errico 2016 年 9 月 24 日
Um, I suppose that is a valid question. Is it not obvious? :) Ok, maybe not completely so.
The trick is to recognize that when you do a spy plot, you created a set of axes. The handle to those axes is given by gca (the current set of axes that are up front.)
So if you do
get(gca)
you will see lots of things. One of them is 'children'. What you actually plotted are children of those axes. So
get(gca,'children')
gives a handle to what is in the plot. In this case, it is only one thing, a set of dots as line, created by spy.
get(gca,'children')
ans =
Line with properties:
Color: [0 0 1]
LineStyle: 'none'
LineWidth: 0.5
Marker: '.'
MarkerSize: 50
MarkerFaceColor: 'none'
XData: [1 1 3 4 6 6 8 8 8 10]
YData: [4 9 4 7 5 6 2 3 6 10]
ZData: [1x0 double]
So now you can control the properties of that plot. You can change the markersize. You can change the color of the dots, both of which I did.
Obvious? I suppose it is not, depending on your programming background. But not that hard once you start to learn about handle graphics in MATLAB. You could start reading under 'Graphics Objects' in the docs.
Jan
Jan 2016 年 9 月 26 日
OK, and what about this: How do I make nodes in "spy" that are closer then "d" connected via solid (OR dotted) line?

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

採用された回答

John D'Errico
John D'Errico 2016 年 9 月 24 日
編集済み: John D'Errico 2016 年 9 月 24 日
spy(sprand(10,10,.1))
set(get(gca,'children'),'markersize',50,'color','r')
get(gca,'children')
ans =
Line with properties:
Color: [0 0 1]
LineStyle: 'none'
LineWidth: 0.5
Marker: '.'
MarkerSize: 50
MarkerFaceColor: 'none'
XData: [1 1 3 4 6 6 8 8 8 10]
YData: [4 9 4 7 5 6 2 3 6 10]
ZData: [1x0 double]

その他の回答 (0 件)

カテゴリ

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

製品

Community Treasure Hunt

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

Start Hunting!

Translated by