Unable to change Marker Size in Scatter Plot
146 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
Ed
el 14 de Dic. de 2022
Comentada: Ed
el 15 de Dic. de 2022
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 comentarios
VBBV
el 15 de Dic. de 2022
Editada: VBBV
el 15 de Dic. de 2022
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.
Respuesta aceptada
Walter Roberson
el 15 de Dic. de 2022
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)
0 comentarios
Más respuestas (1)
Bora Eryilmaz
el 14 de Dic. de 2022
Editada: Bora Eryilmaz
el 14 de Dic. de 2022
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.
0 comentarios
Ver también
Categorías
Más información sobre Scatter Plots en Help Center y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!