-
-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
853a219
commit 747595e
Showing
5 changed files
with
28 additions
and
21 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,7 @@ | ||
v 1.2 | ||
v 1.21 | ||
d 'TREEMAP': A Stata package for treemaps | ||
d | ||
d Distribution-Date: 20220925 | ||
d Distribution-Date: 20221122 | ||
d | ||
d Asjad Naqvi, | ||
d [email protected] | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,10 @@ | ||
*! Treemap v1.2 (22 Sep 2022) | ||
*! Treemap v1.21 (22 Nov 2022) | ||
*! Asjad Naqvi ([email protected]) | ||
|
||
* v1.2 (22 Sep 2022): Negative values check. Control over fill intensity. | ||
* v1.1 (13 Sep 2022): Label, color, title scaling. More options for controls. More checks. Better defaults. | ||
* v1.0 (08 Sep 2022): First release | ||
* v1.21 (22 Nov 2022): fixed a bug where duplicate values were causing categories to be dropped. | ||
* v1.2 (22 Sep 2022): Negative values check. Control over fill intensity. | ||
* v1.1 (13 Sep 2022): Label, color, title scaling. More options for controls. More checks. Better defaults. | ||
* v1.0 (08 Sep 2022): First release | ||
|
||
cap prog drop treemap | ||
|
||
|
@@ -34,9 +35,11 @@ prog def treemap, sortpreserve | |
|
||
|
||
qui { | ||
preserve | ||
preserve | ||
keep if `touse' | ||
|
||
|
||
|
||
local length : word count `by' | ||
|
||
if `length' == 1 { | ||
|
@@ -50,8 +53,8 @@ qui { | |
|
||
collapse (sum) `varlist', by(`var0') | ||
|
||
gen var0_v = `varlist' | ||
gsort -var0_v | ||
gen double var0_v = `varlist' | ||
gsort -var0_v `var0' // stabilize the sort | ||
} | ||
|
||
if `length' == 2 { | ||
|
@@ -75,7 +78,7 @@ qui { | |
collapse (sum) `varlist', by(`var0' `var1') | ||
|
||
bysort `var0': egen var0_v = sum(`varlist') | ||
gen var1_v = `varlist' | ||
gen double var1_v = `varlist' | ||
|
||
gsort -var0_v -var1_v | ||
} | ||
|
@@ -109,7 +112,7 @@ qui { | |
|
||
bysort `var0': egen var0_v = sum(`varlist') | ||
bysort `var1': egen var1_v = sum(`varlist') | ||
gen var2_v = `varlist' | ||
gen double var2_v = `varlist' | ||
|
||
gsort -var0_v -var1_v -var2_v | ||
} | ||
|
@@ -118,10 +121,9 @@ qui { | |
gen id = _n | ||
|
||
egen var0_t = tag(`var0') | ||
egen var0_o = group(var0_v) | ||
levelsof var0_o | ||
replace var0_o = r(r) - var0_o + 1 | ||
|
||
gen double var0_o = sum(`var0' != `var0'[_n-1]) | ||
|
||
|
||
if `length' > 1 { | ||
cap drop var1_t | ||
egen var1_t = tag(`var0' `var1') | ||
|
@@ -565,6 +567,7 @@ qui { | |
xsize(`xsize') ysize(`ysize') /// | ||
`title' `subtitle' `note' `scheme' `name' | ||
|
||
|
||
restore | ||
} | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters