Problem using LineStyle

4 ビュー (過去 30 日間)
Luke Chen
Luke Chen 2011 年 4 月 5 日
When I use LineStyle to only change the shape of the line, it works fine. When I use it to change the color, it gives me this error:
??? Error using ==> line Bad property value found. Object Name : line Property Name : 'LineStyle'.
For example,
line(....'LineStyle', ':') works fine, but line(....'LineStyle', 'k:') will cause a crash
Can someone explain why?

採用された回答

Luke Chen
Luke Chen 2011 年 4 月 5 日
I am writing this function:
function finalPositions = networkEdit(weights, names, nodeStyle, linkStyle)
linkStyle is one string that determines the shape and color of all lines in the subsequent plot. So if linkStyle = 'k:', it should make all lines black and dotted. If I want black dotted lines, do I have to take linkStyle and break it up into 'k' and ':' or is there a way to use the string 'k:' without breaking it up?
  6 件のコメント
Matt Fig
Matt Fig 2011 年 4 月 5 日
Then you did something else wrong.
plot(1:2,3:4,'k:') % Works for me....
Luke Chen
Luke Chen 2011 年 4 月 5 日
Deleted 'LineStyle' from the arguments and it works now.
Thank you so much

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

その他の回答 (1 件)

Matt Fig
Matt Fig 2011 年 4 月 5 日
That is because you are using the LineStyle property to try to change the Color property.
L = plot(1:10);
set(L,'linestyle',':','color','k')

カテゴリ

Help Center および File ExchangeCreating, Deleting, and Querying Graphics Objects についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by