scatter plot (need matlab script)
조회 수: 13 (최근 30일)
이전 댓글 표시
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
the cyclist
2021년 4월 21일
편집: the cyclist
2021년 4월 21일
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?
채택된 답변
Atsushi Ueno
2021년 4월 21일
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');
추가 답변 (2개)
David Hill
2021년 4월 21일
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);
댓글 수: 0
Steven Lord
2021년 4월 21일
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
the cyclist
2021년 4월 21일
Solid advice here.
참고 항목
카테고리
Help Center 및 File Exchange에서 Data Distribution Plots에 대해 자세히 알아보기
제품
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!