Hi all,
I need help in my scatterplot. Below is my data:
And below is my scatterplot:

I would like to only display the marker labels for 10 countries and shade them in red: China, India, Indonesia, Japan, Malaysia, Philippines, Singapore, ROK, Thailand, Vietnam. I would like to hide the marker labels for those countries not included in the list.
These are my codes:
Is it also possible to display the correlation coefficient in two decimal places in the note section of the scatterplot?
Thanks!
I need help in my scatterplot. Below is my data:
Code:
* Example generated by -dataex-. For more info, type help dataex clear input double(Trust_safety FixedCapital) str12 Country int Year 62.1 . "China" 2018 . . "Hong Kong" 2018 65.1 . "India" 2018 65.9 . "Indonesia" 2018 47.9 . "Japan" 2018 56.5 . "Malaysia" 2018 56.7 . "Philippines" 2018 49.8 . "Singapore" 2018 47.7 . "ROK" 2018 35.1 . "Thailand" 2018 67.4 . "Vietnam" 2018 73.2 2.8343838429868544 "China" 2019 . 1.2972031932934354 "Hong Kong" 2019 70.7 -1.1228850019365764 "India" 2019 69.5 -1.2269742825688812 "Indonesia" 2019 44.1 .5939266551266914 "Japan" 2019 63.6 -.07421756851016817 "Malaysia" 2019 56 -1.1756676833233706 "Philippines" 2019 52.6 .44717951149067064 "Singapore" 2019 46.2 .6093922000991148 "ROK" 2019 57.3 -.956631552055974 "Thailand" 2019 66.5 -.39595896084634924 "Vietnam" 2019 55.7 -.06068384945470433 "Saudi Arabia" 2019 53.2 .4518415311414805 "Australia" 2019 59.8 .4508400249329308 "Canada" 2019 60.6 -.34168072936252025 "Chile" 2019 61.3 -.5915731420517907 "Mexico" 2019 59.2 .33182234205797173 "New Zealand" 2019 60 -1.0703165310188145 "Peru" 2019 . . "" . . . "" . . . "" . . . "" . . . "" . . . "" . . . "" . . . "" . . . "" . . . "" . . . "" . . . "" . . . "" . . . "" . . . "" . . . "" . . . "" . . . "" . . . "" . . . "" . . . "" . end
I would like to only display the marker labels for 10 countries and shade them in red: China, India, Indonesia, Japan, Malaysia, Philippines, Singapore, ROK, Thailand, Vietnam. I would like to hide the marker labels for those countries not included in the list.
These are my codes:
Code:
correlate Trust_safety FixedCapital if Year == 2019 & Country != "Hong Kong" & Country!= "China" // Removing China improves fit local r(rho): display %5.4f e(r(rho)) twoway scatter Trust_safety FixedCapital if Year == 2019 & Country != "Hong Kong" & Country!= "China" , mlabel(Country) || lfit Trust_safety FixedCapital if Year == 2019 & Country != "Hong Kong" & Country!= "China" , note(correlation coefficient = `r(rho)') ytitle(Trust & Safety score) range(-2 1.5) // with labels and linear fit, need to adjust the x-axis so that it can fit, y-axis label name too
Is it also possible to display the correlation coefficient in two decimal places in the note section of the scatterplot?
Thanks!
Comment