Fill function not accepting hexadecimal colors

>> A = [2 2 4 4];
>> B = [5 3 3 5];
>> fill(A,B,"blue");
Above produces expected result
>> fill(A,B,"#0000FF");
"Error using fill
Invalid color, marker, or line style."
But using "#0000FF" or any hexadecimal color throws an error. Why? Using version R2023a

 採用された回答

Voss
Voss 2024 年 4 月 26 日

0 投票

A = [2 2 4 4];
B = [5 3 3 5];
patch("XData",A,"YData",B,"FaceColor","#0000FF");

2 件のコメント

Voss
Voss 2024 年 4 月 26 日
編集済み: Voss 2024 年 4 月 26 日
A = [2 2 4 4];
B = [5 3 3 5];
fill(A,B,"","FaceColor","#0000FF");
Adam Danz
Adam Danz 2026 年 3 月 10 日
Voss' suggestion is good. Another approach: hex2rgb
fill(A,B,hex2rgb("#0000FF"))

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

その他の回答 (0 件)

カテゴリ

ヘルプ センター および File ExchangeLine Plots についてさらに検索

製品

リリース

R2023a

質問済み:

2024 年 4 月 26 日

コメント済み:

2026 年 3 月 10 日

Community Treasure Hunt

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

Start Hunting!

Translated by