Borrar filtros
Borrar filtros

How to add line style after color

2 visualizaciones (últimos 30 días)
Asir Tushar
Asir Tushar el 9 de En. de 2020
Respondida: Star Strider el 9 de En. de 2020
If I give the colors using [0 0.4470 0.7410] , then how to give the line circle or square shapes ??
I know that plot(x,y,'r+') is used to give the color and style.

Respuesta aceptada

Star Strider
Star Strider el 9 de En. de 2020
Try this:
figure
hl = plot((0:9), rand(1,10));
hl.Color = [0 0.4470 0.7410]; % Define Line Color
hl.LineStyle = '-'; % Define Line Style
hl.Marker = 's'; % Define ‘square’ Marker
hl.MarkerFaceColor = 'g'; % Define ‘square’ Marker Color
Use the structure syntax to change the line and marker parameters after the line is plotted.

Más respuestas (1)

Mateus Banroc
Mateus Banroc el 9 de En. de 2020
Hi Asir,
For circle shapes, use 'o'
For square shapes, use 's'.
Check this page about plot properties
https://www.mathworks.com/help/matlab/ref/matlab.graphics.chart.primitive.line-properties.html

Etiquetas

Community Treasure Hunt

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

Start Hunting!

Translated by