Unable to change Marker Size in Scatter Plot

145 次查看(过去 30 天)
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.

请先登录,再进行评论。

采纳的回答

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