Assign different symbols to my scatter3 plot.

1 visualización (últimos 30 días)
Tiago Angelo
Tiago Angelo el 18 de Sept. de 2020
Editada: KSSV el 18 de Sept. de 2020
I have a table with the following variables: Type, X, Y, and Z
Type is a string. X, Y and Z are numbers.
I am using this code to plot my data:
clf;
subplot(2,2,1)
a=scatter3(X,Y,Z,20,Z,'o','Filled');view(0,90);
colormap(jet);colorbar
set(gca, 'PlotBoxAspectRatio', [1,1,1])
set(gca, 'xticklabel',num2str(''))
However, this gives me only filled circles as symbols. I want to differentiate my data using the Type Column, and assign a different symbol instead of only circles for different Types.
I thank you in advance.

Respuestas (1)

KSSV
KSSV el 18 de Sept. de 2020
REad about gscatter.
Or You have to assign different markers based on Z and plot.
  2 comentarios
Tiago Angelo
Tiago Angelo el 18 de Sept. de 2020
Thanks for your answer! I will give a read about it. :))
How could I assign different markers based on my strings in the Type column?
KSSV
KSSV el 18 de Sept. de 2020
Editada: KSSV el 18 de Sept. de 2020
[C,ia,ib] = uniuqe(Z) ; %expecting Z to be strings
N = length(C) ;
S = {'o', '*', 'd','t'} ; % Give your markers here
figure
hold on
for i = 1:4
plot(x(ib==i),y(ib==i),S{i})
end
gscatter best suits you..Read about it.

Iniciar sesión para comentar.

Categorías

Más información sobre Graphics Object Programming en Help Center y File Exchange.

Community Treasure Hunt

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

Start Hunting!

Translated by