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

 采纳的回答

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

2 个评论

A = [2 2 4 4];
B = [5 3 3 5];
fill(A,B,"","FaceColor","#0000FF");
Voss' suggestion is good. Another approach: hex2rgb
fill(A,B,hex2rgb("#0000FF"))

请先登录,再进行评论。

更多回答(0 个)

类别

帮助中心File Exchange 中查找有关 Migrate GUIDE Apps 的更多信息

产品

版本

R2023a

提问:

2024-4-26

评论:

2026-3-10,22:13

Community Treasure Hunt

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

Start Hunting!

Translated by