필터 지우기
필터 지우기

How to do a scatter plot?

조회 수: 3 (최근 30일)
Andrea Miceli
Andrea Miceli 2021년 9월 24일
답변: Kumar Pallav 2021년 9월 29일
Hello evreyone, is someone able to get a graph as in the picture that I attached? Using the dataset down. The scatter plot I got wasn't clear and I am not able to set the name of the point in the graph
ABN Amro 0.0304610987866259
Banque Postale 0.0125500802914051
Barclays 0.0751066947093279
Bayern LB 0
BBVA 0.0272140113130582
BNP Paribas 0.0570048997365625
BPCE 0.0315985393572815
Caixabank 0.00937909528302126
Commerzbank 0.0433994300187407
Credit Agricole 0.0648025139435753
Credit Mutuel 0.0250060877609688
Danske Bank 0.0241676093788770
Deutsche Bank 0.0783261905654609
DNB 0
DZ Bank 0.0798765484414847
Erste Group 0
Handelsbanken 0
HSBC 0.0933062429249327
ING 0.0578695583873232
Intesa Sanpaolo 0.0632893079254154
KBC 0
Lloyds 0.0264976990943249
Nationwide 0.00185915849074004
Nordea 0
Nykredit 0
Rabobank 0.0110645406871962
Sabadell 0
Santander 0.0381992230340928
SEB 0
Societe Generale 0.0700013574821183
Standard Chartered 0
Swedbank 0
Unicredit 0.0790201123874667
  댓글 수: 1
Mitsu
Mitsu 2021년 9월 24일
편집: Mitsu 2021년 9월 24일
A plot like that can be represented by the plot(x,y,'rd') function. rd specifies color red and diamond shape. To add a name to a point on the plot, you may use the text(x,y,word) function.
However, you need two variables. For the list of banks, there seems to be only 1 parameter. If you wish to plot it like in the figure, you need a second parameter so that for each value on the horizontal axis, there is a corresponding value on the vertical axis.

댓글을 달려면 로그인하십시오.

답변 (1개)

Kumar Pallav
Kumar Pallav 2021년 9월 29일
You would have to first clean the data so that there are two columns (ie a name value pair data).
T = readtable('clean_data.csv'); %load csv in tabel format
scatter(T{:,2},T{:,2}) %scatter plot with same x, y values = second column
text(T{:,2},T{:,2},T{:,1}) %text description being the first column
Refer this for adding text descriptions to data points.
For scatter plot, refer this documentation.

카테고리

Help CenterFile Exchange에서 Surface and Mesh Plots에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by