I've been trying to make a more advanced scatter plot and have managed to figure out the bits and pieces of it. Essentially, I want the burden of disease on the y axis and GDP on the x axis, with horizontal and vertical lines going through their averages. I also want to weight the circles by population and have the country's names show up. However, I am having some issues when I put my individual codes together.
(I have added a photo of the graph I would like to produce)
One of my issues has been:
country: may not use time-series operators on string variables Would someone be able to give me insight into how to surpass this error?
Also, would somebody have tips on the order so that the graph can look like my drawing? This is my current code:
input *Merged Data Set using "Combine Datasets" Button* *Generate log of both X & Y Variables* generate log_dalys = log(dalys) *Find Means of both X & Y Variables* summarize log_dalys // mean = 8.868019 summarize log_nhexp_reh // mean = 16.7221 *Making Scatter Plot* scatter log_dalys log_nhexp_reh mlabel(country) msymbol(circle_hollow) [w=pop] || lfit dalys nhexp_reh || yline(8.868019) xline(16.7221) end
Array
My data set looks similar to this:
USA | 2016 | 100 | 100 | 1 | 150 | 2 |
USA | 2017 | 200 | 150 | 2 | 150 | 2 |
USA | 2018 | 300 | 200 | 3 | 150 | 2 |
Korea | 2016 | 100 | 100 | 1 | 150 | 2 |
Korea | 2017 | 200 | 150 | 2 | 150 | 2 |
Korea | 2018 | 300 | 200 | 3 | 150 | 2 |
0 Response to How should I fix this error in my scatter plot?
Post a Comment