I am using catplot (thanks Nick for the great package) and I am trying to have 2 dimensions of colors. In the first variable grouping, I want different intensities of color by group. In the second variable grouping, I want different base colors e.g. blue, red, and purple. For example, see the below code:
For some data input use below:
Code:
* Example generated by -dataex-. To install: ssc install dataex clear input byte(politics political_degree) 1 2 2 3 2 3 2 3 2 3 2 2 2 2 2 2 2 2 1 5 1 5 1 5 1 5 1 3 1 3 1 3 1 3 0 4 0 4 0 4 0 4 end
Code:
catplot political_degree politics, /// percent(politics) /// var1opts(relabel(1 "Not at all" 2 " " /// 3 " " 4 " " 5 "Exetremely") label(labsize(small))) /// var2opts(relabel(1 "Independent/Other" 2 "Republican Party" 3 "Democratic Party") label(labsize(small))) /// l1title("") /// ytitle("Percent of Participants by Political Party", size(small)) /// title("Political Party Affiliation by Strength of Association", size(medium)) /// recast(bar) /// blabel(bar, format(%4.1f) size(vsmall)) /// graphregion(fcolor(white)) /// intensity(25) /// asyvars /// bar(1, color(navy) fintensity(inten20)) /// bar(2, color(navy) fintensity(inten40)) /// bar(3, color(navy) fintensity(inten60)) /// bar(4, color(navy) fintensity(inten80)) /// bar(5, color(navy) fintensity(inten100)) /// legend(rows(1) stack size(small) /// order(1 "Not at all" 2 "" 3 "" /// 4 "" 5 "Extremely") /// symplacement(center) /// title(Strength of Political Affiliation, size(small)))
Is this at all possible? Does it have something to do with putting bar() inside of var#opt?
Any help would be great!
Best
Nick
0 Response to Catplot - Varying Base & Intensity Colors Across Multiple Groups
Post a Comment