From 747595e9df481db908e55c9ab39dd56c60087c4b Mon Sep 17 00:00:00 2001 From: Asjad Naqvi Date: Tue, 22 Nov 2022 23:47:22 +0100 Subject: [PATCH] v1.21 fixes --- README.md | 6 +++++- installation/stata.toc | 4 ++-- installation/treemap.ado | 29 ++++++++++++++++------------- installation/treemap.pkg | 6 +++--- installation/treemap.sthlp | 4 ++-- 5 files changed, 28 insertions(+), 21 deletions(-) diff --git a/README.md b/README.md index 9254763..7da3620 100644 --- a/README.md +++ b/README.md @@ -1,7 +1,7 @@ ![StataMin](https://img.shields.io/badge/stata-2015-blue) ![issues](https://img.shields.io/github/issues/asjadnaqvi/stata-treemap) ![license](https://img.shields.io/github/license/asjadnaqvi/stata-treemap) ![Stars](https://img.shields.io/github/stars/asjadnaqvi/stata-treemap) ![version](https://img.shields.io/github/v/release/asjadnaqvi/stata-treemap) ![release](https://img.shields.io/github/release-date/asjadnaqvi/stata-treemap) -# treemap v1.2 +# treemap v1.21 This package provides the ability to draw treemaps Stata. @@ -271,6 +271,10 @@ Please open an [issue](https://github.com/asjadnaqvi/stata-treemap/issues) to re ## Versions +**v1.21 (22 Nov 2022)** +- Removed error where duplicate values were causing categories to be dropped. +- Stablized the sort order to prevent random trees across different runs. + **v1.2 (25 Sep 2022)** - Fill intensity control added. - Error checks for negative values. diff --git a/installation/stata.toc b/installation/stata.toc index a1425d9..8cf9de5 100644 --- a/installation/stata.toc +++ b/installation/stata.toc @@ -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 asjadnaqvi@gmail.com diff --git a/installation/treemap.ado b/installation/treemap.ado index bad6e29..66dff14 100644 --- a/installation/treemap.ado +++ b/installation/treemap.ado @@ -1,9 +1,10 @@ -*! Treemap v1.2 (22 Sep 2022) +*! Treemap v1.21 (22 Nov 2022) *! Asjad Naqvi (asjadnaqvi@gmail.com) -* 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 } diff --git a/installation/treemap.pkg b/installation/treemap.pkg index 484daa7..490ec05 100644 --- a/installation/treemap.pkg +++ b/installation/treemap.pkg @@ -1,4 +1,4 @@ -v 1.2 +v 1.21 d {bf:TREEMAP}: A Stata package for treemaps d d Requires: Stata version 15 or higher. @@ -8,9 +8,9 @@ d KW: graphs d KW: treemap d KW: squarify d -d Distribution-Date: 20220922 +d Distribution-Date: 20221122 d -d This version: 25 Sep 2022 +d This version: 22 Nov 2022 d First version: 08 Sep 2022 d License: MIT d diff --git a/installation/treemap.sthlp b/installation/treemap.sthlp index 533aa26..ee03398 100644 --- a/installation/treemap.sthlp +++ b/installation/treemap.sthlp @@ -1,7 +1,7 @@ {smcl} -{* 22Sep2022}{...} +{* 22Nov2022}{...} {hi:help treemap}{...} -{right:{browse "https://github.com/asjadnaqvi/stata-treemap":treemap v1.2 (GitHub)}} +{right:{browse "https://github.com/asjadnaqvi/stata-treemap":treemap v1.21 (GitHub)}} {hline}