Filter löschen
Filter löschen

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

2 Ansichten (letzte 30 Tage)
MAT NIZAM UTI
MAT NIZAM UTI am 9 Jan. 2023
Beantwortet: Dinesh am 28 Feb. 2023
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 Kommentar
Dyuman Joshi
Dyuman Joshi am 9 Jan. 2023
What do you mean by "orderly sequence"?
The functions will plot according to what the input and the data is.

Melden Sie sich an, um zu kommentieren.

Antworten (1)

Dinesh
Dinesh am 28 Feb. 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]

Produkte

Community Treasure Hunt

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

Start Hunting!

Translated by