Plotting 3D lines with color

22 visualizaciones (últimos 30 días)
Ata Oezguen Karabacak
Ata Oezguen Karabacak el 2 de Mzo. de 2021
Comentada: Ata Oezguen Karabacak el 3 de Mzo. de 2021
Say I have spherical coordinates for a high number of lines, namely [x_from x_to], [y_from y_to] and [z_from z_to].
I can plot them on the globe I have prepared earlier within a for loop for the length of lines as in:
plot3([x_from x_to], [y_from y_to], [z_from z_to])
However I was not able to plot them with their assigned color of line color equal to some rgb value ([0.5 1 0]) . I have tried the color scheme in 2D plot and it works. Do you have any suggestions? Thanks for your replies in advance!
plot3([x_from x_to], [y_from y_to], [z_from z_to], 'Color', line_color)
  2 comentarios
Jan
Jan el 2 de Mzo. de 2021
Please explain, what "was not able to plot them with their assigned color" means. What happens, if you try this? Is there an error message or does the result differ from your expectations?
Ata Oezguen Karabacak
Ata Oezguen Karabacak el 2 de Mzo. de 2021
Program does not execute the line due some scalar error. Leaving out the " 'Color', line_color " part it plots the lines.

Iniciar sesión para comentar.

Respuestas (1)

Cris LaPierre
Cris LaPierre el 2 de Mzo. de 2021
We are problably missing some details, but I can create a dummy example using the syntax you show, and it works.
plot3(1:3,3:5,2:4,'Color',[0.5 1 0])
  1 comentario
Ata Oezguen Karabacak
Ata Oezguen Karabacak el 3 de Mzo. de 2021
Yes, the problematic part was not due to coloring after checking it again. Thanks for your reply though, since it helped it.

Iniciar sesión para comentar.

Categorías

Más información sobre Interactive Control and Callbacks en Help Center y File Exchange.

Etiquetas

Productos


Versión

R2013b

Community Treasure Hunt

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

Start Hunting!

Translated by