Borrar filtros
Borrar filtros

color plot arguments questions

10 visualizaciones (últimos 30 días)
fima v
fima v el 10 de Mayo de 2019
Comentada: fima v el 10 de Mayo de 2019
Hello ,what is the role of 'color' and col(d,:) arguments in the plot command?
plot(phi, eta * abs(J), 'color', col(d,:));
I couldnt find in the syntax bellow this pattern.
Thanks
‏‏לכידה.JPG

Respuesta aceptada

Steven Lord
Steven Lord el 10 de Mayo de 2019
That is using the plot(___,Name,Value) syntax where ___ is replaced by phi, eta * abs(J). 'Color' is listed in the Name-Value Pair Arguments subsection of the Input Arguments section on the plot documentation page and col(d,:) is the value for that name.
Look at the "Add Title and Axis Labels" example on the plot documentation page for a demonstration of that syntax. In that case the RGB value used to color the line is [0, 0.7, 0.9] -- no red, a lot of green, and even more blue makes the line blue-green.
  7 comentarios
Steven Lord
Steven Lord el 10 de Mayo de 2019
[0 1 1] corresponds to green + blue = cyan. So if you want to plot your data in cyan yes, that will work. If you did a different combination, like [0.5 0 0] (maroon) or [0.75 0.75 0.75] (silver) it would be different colors. I got those color combinations from Wikipedia. MATLAB doesn't recognize the names 'maroon' or 'silver' but it does recognize the RGB triplet.
There are other Name / Value pairs plot recognizes, like 'LineWidth' (to make thicker or thinner lines) and 'MarkerSize' (larger or smaller markers.) The plot documentation pages lists the most commonly used one, the documentation page listing the properties of the graphics object plot returns (which is linked at the end of the plot documentation page) lists more.
v = 1:10;
plot(v, v.^2, ... % plot points on y = x.^2
'Color', [0.75 0.75 0.75], ... % in silver / light gray
'LineWidth', 4, ... % using a thick line
'Marker', 'p', ... % with star markers
'MarkerSize', 24) % and make the stars big
fima v
fima v el 10 de Mayo de 2019
Thank you very much.

Iniciar sesión para comentar.

Más respuestas (0)

Categorías

Más información sobre Line Plots en Help Center y File Exchange.

Etiquetas

Community Treasure Hunt

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

Start Hunting!

Translated by