How to make sure the symbol and colour for the Scatter plot

2 次查看(过去 30 天)
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 个评论
Dyuman Joshi
Dyuman Joshi 2023-1-9
What do you mean by "orderly sequence"?
The functions will plot according to what the input and the data is.

请先登录,再进行评论。

回答(1 个)

Dinesh
Dinesh 2023-2-28
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]

类别

Help CenterFile Exchange 中查找有关 Scatter Plots 的更多信息

产品

Community Treasure Hunt

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

Start Hunting!

Translated by