scatter plot (need matlab script)

2 visualizaciones (últimos 30 días)
unkn
unkn el 21 de Abr. de 2021
Comentada: unkn el 21 de Abr. de 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 comentarios
the cyclist
the cyclist el 21 de Abr. de 2021
Editada: the cyclist el 21 de Abr. de 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 el 21 de Abr. de 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.

Iniciar sesión para comentar.

Respuesta aceptada

Atsushi Ueno
Atsushi Ueno el 21 de Abr. de 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');

Más respuestas (2)

David Hill
David Hill el 21 de Abr. de 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 el 21 de Abr. de 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.
  1 comentario
the cyclist
the cyclist el 21 de Abr. de 2021
Solid advice here.
Another source for plotting code is the MATLAB Plot Gallery.

Iniciar sesión para comentar.

Categorías

Más información sobre Data Distribution Plots en Help Center y File Exchange.

Etiquetas

Productos

Community Treasure Hunt

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

Start Hunting!

Translated by