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

 Respuesta aceptada

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

2 comentarios

Voss
Voss el 26 de Abr. de 2024
Editada: Voss el 26 de Abr. de 2024
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"))

Iniciar sesión para comentar.

Más respuestas (0)

Categorías

Más información sobre Migrate GUIDE Apps en Centro de ayuda y File Exchange.

Productos

Versión

R2023a

Preguntada:

el 26 de Abr. de 2024

Comentada:

hace alrededor de 15 horas

Community Treasure Hunt

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

Start Hunting!

Translated by