How to make sure the symbol and colour for the Scatter plot
1 visualización (últimos 30 días)
Mostrar comentarios más antiguos
I tried to generate a scatter plot based on (:,1) data using this code to groups/cluster the data into 5 cluster
subplot(2,2,3);
gscatter(zz(:,1),y,IDX,'bgm','xo+*.')
hold on
plot(C(:,1),C(:,1),'kx');
grid on;
xlabel('Data point');
ylabel('No of observations');
title ('Scatter plot of average wave energy density for 28 years (1993 to 2020)- after cluster');
legend ('Cluster 1', 'Cluster 2','Cluster 3', 'Cluster 4', 'Cluster 5','Cluster Centroid');
hold off;
But, when i run the code the symbol/colour is not in follow the legend. I want the legend to follow the graph. But the legend is not place orderly as the plot. Also may I know how to change the symbol size.
1 comentario
Dyuman Joshi
el 9 de En. de 2023
What do you mean by "orderly sequence"?
The functions will plot according to what the input and the data is.
Respuestas (1)
Dinesh
el 28 de Feb. de 2023
Hi !
It looks like you want to place the legend right under the graph. You can do that using legend location "lcn" parameter.
Refer this MATLAB documentation to change location of legend on the plot [use southoutside to place it outside the axes].
About the part on how to change the symbol size on scatter plot we can use the size "sz" argument.
Refer this MATLAB documentation to change marker size. [Set marker size to a higher value like 15-20 to notice the change]
0 comentarios
Ver también
Categorías
Más información sobre Scatter Plots en Help Center y File Exchange.
Productos
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!