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
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
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]
댓글 수: 0
참고 항목
카테고리
Help Center 및 File Exchange에서 Scatter Plots에 대해 자세히 알아보기
제품
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!