필터 지우기
필터 지우기

Unable to change Marker Size in Scatter Plot

조회 수: 139 (최근 30일)
Ed
Ed 2022년 12월 14일
댓글: Ed 2022년 12월 15일
Hi, I imported a .csv file into MATLAB, auto-generated code, and clicked the icon to create a scatter plot. The screens are shown in the first three attachments (mat1, mat2, mat3). The problem I am having is that I want to change the size of the Markers in the plot to a smaller size. I cannot do that.
Here is what I tried : On the plot menu, I selected "File --> Generate Code". I got the fourth attached screen print (mat4). I know that I can change the marker size to (say 5) by changing the command: scatter(X1,Y1); to scatter(X1,Y1,5); so I made that change in the code. Then I selected the scatter plot option at the top of the screen. However, the markers did not change in the resulting plot. They were the same size. Please tell me what I am doing wrong, and how to do this correctly. Thank you!
  댓글 수: 2
VBBV
VBBV 2022년 12월 15일
편집: VBBV 2022년 12월 15일
If you want to change the Markersize in scatter plot, you need to navigate to property editor by selecting View -> Property Editor. Then select the marker in the plot, then you will be able to see a new box beneath the plot where you can edit size value for Marker. After entering new value, click on the Refresh Data button to the right, you can then see the changes.
when you change the Markersize of the scatter function call in your code, you need to run the script again in order to see the effect of markersize in plot.
Ed
Ed 2022년 12월 15일
Thank you. That worked great.
Ed

댓글을 달려면 로그인하십시오.

채택된 답변

Walter Roberson
Walter Roberson 2022년 12월 15일
When you choose the scatter plot option at the top of the screen, that executes a new call to scatter() with appropriate parameters; it does not execute the code in createfigure.
You should be using
createfigure(extent.VarName1, extent.VarName2)

추가 답변 (1개)

Bora Eryilmaz
Bora Eryilmaz 2022년 12월 14일
편집: Bora Eryilmaz 2022년 12월 14일
You just need to pick a good value:
x = rand(10,1);
y = rand(10,1);
subplot(211)
scatter(x,y)
subplot(212)
scatter(x,y,100)
The default is equivalent to sz = 36.

카테고리

Help CenterFile Exchange에서 Scatter Plots에 대해 자세히 알아보기

제품


릴리스

R2022b

Community Treasure Hunt

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

Start Hunting!

Translated by