scatter plot (need matlab script)

14 visualizzazioni (ultimi 30 giorni)
unkn
unkn il 21 Apr 2021
Commentato: unkn il 21 Apr 2021
x=[2.6498, 5.4147, 7.7189, 7.9493, 7.2581, 47.5806, 44.1244, 78.4562, 73.3871, 74.3088, 91.8203, 96.659, 95.9677, 36.9816, 35.1382, 35.5991, 40.2074, 16.4747, 9.7926, 68.0876];
y=[11.4035, 7.3099, 14.9123, 95.0292, 85.6725, 91.5205, 82.1637, 13.7427, 14.3275, 27.193, 183.9181, 177.4854, 192.1053, 157.0175, 163.4503, 175.731, 172.2222, 106.1404, 114.9123, 123.6842];
  2 Commenti
the cyclist
the cyclist il 21 Apr 2021
Modificato: the cyclist il 21 Apr 2021
If you expect us to spend time helping you solve your problem, you should spend more time explaining what you are trying to do, and ask specific questions about where you are stuck.
The image you posted is not a scatter plot. Do you want a scatter plot of x and y? Or are you trying to create a figure like the one in the picture?
unkn
unkn il 21 Apr 2021
x=[2.6498, 5.4147, 7.7189, 7.9493, 7.2581, 47.5806, 44.1244, 78.4562, 73.3871, 74.3088, 91.8203, 96.659, 95.9677, 36.9816, 35.1382, 35.5991, 40.2074, 16.4747, 9.7926, 68.0876];
y=[11.4035, 7.3099, 14.9123, 95.0292, 85.6725, 91.5205, 82.1637, 13.7427, 14.3275, 27.193, 183.9181, 177.4854, 192.1053, 157.0175, 163.4503, 175.731, 172.2222, 106.1404, 114.9123, 123.6842];
from these data, i need the matlab script to get the above plot. can you please explain how to get that plot.

Accedi per commentare.

Risposta accettata

Atsushi Ueno
Atsushi Ueno il 21 Apr 2021
x=[2.6498, 5.4147, 7.7189, 7.9493, 7.2581, 47.5806, 44.1244, 78.4562, 73.3871, 74.3088, 91.8203, 96.659, 95.9677, 36.9816, 35.1382, 35.5991, 40.2074, 16.4747, 9.7926, 68.0876];
y=[11.4035, 7.3099, 14.9123, 95.0292, 85.6725, 91.5205, 82.1637, 13.7427, 14.3275, 27.193, 183.9181, 177.4854, 192.1053, 157.0175, 163.4503, 175.731, 172.2222, 106.1404, 114.9123, 123.6842];
histogram2(x,y,11,'DisplayStyle','tile','ShowEmptyBins','on','XBinLimits',[0 110],'YBinLimits',[0 220]);
colorbar;
colormap('jet');
xlabel('\bfX');
ylabel('\bfY');
title('\bfJoint Distribution - X and Y');

Più risposte (2)

David Hill
David Hill il 21 Apr 2021
x=[2.6498, 5.4147, 7.7189, 7.9493, 7.2581, 47.5806, 44.1244, 78.4562, 73.3871, 74.3088, 91.8203, 96.659, 95.9677, 36.9816, 35.1382, 35.5991, 40.2074, 16.4747, 9.7926, 68.0876];
y=[11.4035, 7.3099, 14.9123, 95.0292, 85.6725, 91.5205, 82.1637, 13.7427, 14.3275, 27.193, 183.9181, 177.4854, 192.1053, 157.0175, 163.4503, 175.731, 172.2222, 106.1404, 114.9123, 123.6842];
n=histcounts2(x,y,0:10:110,0:20:220);
n=rot90(n);

Steven Lord
Steven Lord il 21 Apr 2021
That doesn't look like a scatter plot. It looks more like a heatmap chart. Though you are going to need to bin your data if you want to make a heatmap, and David Hill's suggestion of histcounts2 seems reasonable.
As a general idea, if you have an idea of a type of plot you want to create but you're not sure if there's a function to create that plot, click on the Plots tab of the Toolstrip. You can expand the Plots section of that tab to see thumbnails of some of the types of plots you can create with MATLAB. The name of the function that you'd use to create that type of plot is below the thumbnail. If you have your data selected in the Workspace desktop component you can even limit what gets shown to the types of plots compatible with the selected data. heatmap and pcolor in the "MATLAB Image Plots" section look close to the picture you showed.

Categorie

Scopri di più su Data Distribution Plots in Help Center e File Exchange

Prodotti

Community Treasure Hunt

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

Start Hunting!

Translated by