Dear all,
I am using twoway scatter to graph the relationship between Gini and GDP for five regions in two years. And I am using the new colorvar() function because I want to distinguish between the year and the region.
The goal is to have each region in one color, and two symbols represent different years.
However, the problem is that year legend has the same color as the first region, which might be confusing. And I want to change it to black.
Does anyone know how to do it?
My code
And in the attached graph, you can see that the symbol of the year legend is in the same color as the first region.
Thank you very much in advance for the help!
I am using twoway scatter to graph the relationship between Gini and GDP for five regions in two years. And I am using the new colorvar() function because I want to distinguish between the year and the region.
The goal is to have each region in one color, and two symbols represent different years.
However, the problem is that year legend has the same color as the first region, which might be confusing. And I want to change it to black.
Does anyone know how to do it?
My code
Code:
twoway (scatter Gini GDP if year==2010, colorvar(region) colordiscrete colorrule(phue) coloruseplegend msize(medium) msymbol(circle)) /// (scatter Gini GDP if year==2018, colorvar(region) colordiscrete colorrule(phue) coloruseplegend msize(medium) msymbol(diamond)), /// zlabel(, valuelabel) legend( lab(1 "2010") lab(2 "2018") pos(6) row(1) )
Thank you very much in advance for the help!
Comment