Azzera filtri
Azzera filtri

Unable to change Marker Size in Scatter Plot

145 visualizzazioni (ultimi 30 giorni)
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 Commenti
VBBV
VBBV il 15 Dic 2022
Modificato: VBBV il 15 Dic 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.
Ed
Ed il 15 Dic 2022
Thank you. That worked great.
Ed

Accedi per commentare.

Risposta accettata

Walter Roberson
Walter Roberson il 15 Dic 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)

Più risposte (1)

Bora Eryilmaz
Bora Eryilmaz il 14 Dic 2022
Modificato: Bora Eryilmaz il 14 Dic 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.

Prodotti


Release

R2022b

Community Treasure Hunt

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

Start Hunting!

Translated by