diff --git a/CITATION.cff b/CITATION.cff
index 8acb1ee..5c20a6b 100644
--- a/CITATION.cff
+++ b/CITATION.cff
@@ -3,6 +3,6 @@ authors:
- family-names: "Naqvi"
given-names: "Asjad"
title: "Stata package ``sankey''"
-version: 1.61
-date-released: 2023-07-22
+version: 1.7
+date-released: 2023-11-06
url: "https://github.com/asjadnaqvi/stata-sankey"
\ No newline at end of file
diff --git a/LICENSE b/LICENSE
index 569353b..fb09ad3 100644
--- a/LICENSE
+++ b/LICENSE
@@ -1,6 +1,6 @@
MIT License
-Copyright (c) 2022 Asjad Naqvi
+Copyright (c) 2023 Asjad Naqvi
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
diff --git a/README.md b/README.md
index 6ed0fbc..e6d90cc 100644
--- a/README.md
+++ b/README.md
@@ -9,8 +9,8 @@
---
-# sankey v1.61
-(22 Jul 2023)
+# sankey v1.7
+(06 Nov 2023)
This package allows users to draw Sankey plots in Stata. It is based on the [Sankey Guide](https://medium.com/the-stata-guide/stata-graphs-sankey-diagram-ecddd112aca1) published on [the Stata Guide](https://medium.com/the-stata-guide) on Medium on October 2021.
@@ -25,7 +25,7 @@ SSC (**v1.6**):
ssc install sankey, replace
```
-GitHub (**v1.61**):
+GitHub (**v1.7**):
```
net install sankey, from("https://raw.githubusercontent.com/asjadnaqvi/stata-sankey/main/installation/") replace
@@ -62,15 +62,16 @@ graph set window fontface "Arial Narrow"
The syntax for **v1.6** is as follows:
-```applescript
+```stata
sankey value [if] [in], from(var) to(var) by(var)
[ palette(str) colorby(layer|level) colorvar(var) stock colorvarmiss(str) colorboxmiss(str)
- smooth(1-8) gap(num) recenter(mid|bot|top) ctitles(list) ctgap(num) ctsize(num)
+ smooth(1-8) gap(num) recenter(mid|bot|top) ctitles(list) ctgap(num) ctsize(num) ctposition(bot|top)
labangle(str) labsize(str) labposition(str) labgap(str) showtotal labprop labscale(num)
valsize(str) valcondition(num) format(str) valgap(str) novalues valprop valscale(num)
novalright novalleft nolabels sort1(value|name[, reverse]) sort2(value|order[, reverse])
- lwidth(str) lcolor(str) alpha(num) offset(num) boxwidth(str)
- title(str) subtitle(str) note(str) scheme(str) name(str) xsize(num) ysize(num) ]
+ lwidth(str) lcolor(str) alpha(num) offset(num) boxwidth(str) percent
+ title(str) subtitle(str) note(str) scheme(str) name(str) xsize(num) ysize(num) saving(str) ]
+
```
See the help file `help sankey` for details.
@@ -204,7 +205,7 @@ sankey value, from(source) to(destination) by(layer) sort1(name, reverse) sort2(
Custom sorting on a value:
-```
+```stata
gen source2 = .
gen destination2 = .
@@ -217,7 +218,7 @@ foreach x in source destination {
replace `x'2 = 6 if `x'=="Medium"
replace `x'2 = 7 if `x'=="Website"
replace `x'2 = 8 if `x'=="Homepage"
- replace `x'2 = 9 if `x'=="T```otal"
+ replace `x'2 = 9 if `x'=="Total"
replace `x'2 = 10 if `x'=="Google"
replace `x'2 = 11 if `x'=="Facebook"
}
@@ -338,6 +339,13 @@ sankey value, from(source) to(destination) by(layer) ctitles("Cat 1" "Cat 2" "Ca
+```
+sankey value, from(source) to(destination) by(layer) ctitles("Cat 1" "Cat 2" "Cat 3" "Cat 4" "Cat 5") ctpos(top) ctg(100) recenter(top)
+```
+
+
+
+
### label rotation and offset
```
@@ -419,6 +427,12 @@ Please open an [issue](https://github.com/asjadnaqvi/stata-sankey/issues) to rep
## Change log
+**v1.7 (06 Nov 2023)**
+- Fixed `valcond()` dropping bar values.
+- Fixed `ctitles()` getting random colors. It now defaults to black.
+- Added `ctpos()` option to change column title position.
+- Added `percent` option which is still beta. Convert flows to percent values.
+
**v1.61 (22 Jul 2023)**
- `saving()` option added (requested by Anirban Basu).
- Minor fixes.
diff --git a/figures/sankey10.png b/figures/sankey10.png
index 50ee805..4be5509 100644
Binary files a/figures/sankey10.png and b/figures/sankey10.png differ
diff --git a/figures/sankey2_1.png b/figures/sankey2_1.png
index 84618d8..bc87282 100644
Binary files a/figures/sankey2_1.png and b/figures/sankey2_1.png differ
diff --git a/figures/sankey2_2.png b/figures/sankey2_2.png
index 5942fc3..e66d212 100644
Binary files a/figures/sankey2_2.png and b/figures/sankey2_2.png differ
diff --git a/figures/sankey3_1.png b/figures/sankey3_1.png
index ca5b860..09ee932 100644
Binary files a/figures/sankey3_1.png and b/figures/sankey3_1.png differ
diff --git a/figures/sankey3_2.png b/figures/sankey3_2.png
index 8b7a103..7f1d4dc 100644
Binary files a/figures/sankey3_2.png and b/figures/sankey3_2.png differ
diff --git a/figures/sankey4_1.png b/figures/sankey4_1.png
index d5c9b37..3087852 100644
Binary files a/figures/sankey4_1.png and b/figures/sankey4_1.png differ
diff --git a/figures/sankey4_2.png b/figures/sankey4_2.png
index 0eeea46..5edaee2 100644
Binary files a/figures/sankey4_2.png and b/figures/sankey4_2.png differ
diff --git a/figures/sankey5.png b/figures/sankey5.png
index 3b47c07..9aa5074 100644
Binary files a/figures/sankey5.png and b/figures/sankey5.png differ
diff --git a/figures/sankey5_1.png b/figures/sankey5_1.png
index e8bb9be..c6ef3bc 100644
Binary files a/figures/sankey5_1.png and b/figures/sankey5_1.png differ
diff --git a/figures/sankey5_2.png b/figures/sankey5_2.png
index 46745be..adea459 100644
Binary files a/figures/sankey5_2.png and b/figures/sankey5_2.png differ
diff --git a/figures/sankey5_2_1.png b/figures/sankey5_2_1.png
index c4358c8..36a1784 100644
Binary files a/figures/sankey5_2_1.png and b/figures/sankey5_2_1.png differ
diff --git a/figures/sankey5_2_2.png b/figures/sankey5_2_2.png
index 9310fed..3b43ab8 100644
Binary files a/figures/sankey5_2_2.png and b/figures/sankey5_2_2.png differ
diff --git a/figures/sankey5_2_3.png b/figures/sankey5_2_3.png
index 31aca86..32f1dc5 100644
Binary files a/figures/sankey5_2_3.png and b/figures/sankey5_2_3.png differ
diff --git a/figures/sankey5_2_4.png b/figures/sankey5_2_4.png
index 16b56a5..4da905a 100644
Binary files a/figures/sankey5_2_4.png and b/figures/sankey5_2_4.png differ
diff --git a/figures/sankey5_2_5.png b/figures/sankey5_2_5.png
index 6476a04..a07ec43 100644
Binary files a/figures/sankey5_2_5.png and b/figures/sankey5_2_5.png differ
diff --git a/figures/sankey5_2_6.png b/figures/sankey5_2_6.png
new file mode 100644
index 0000000..7fccebb
Binary files /dev/null and b/figures/sankey5_2_6.png differ
diff --git a/figures/sankey5_3.png b/figures/sankey5_3.png
index b975f5d..d85cdd9 100644
Binary files a/figures/sankey5_3.png and b/figures/sankey5_3.png differ
diff --git a/figures/sankey5_4.png b/figures/sankey5_4.png
index 07daffb..372e05b 100644
Binary files a/figures/sankey5_4.png and b/figures/sankey5_4.png differ
diff --git a/figures/sankey5_5.png b/figures/sankey5_5.png
index 473c137..196cfa4 100644
Binary files a/figures/sankey5_5.png and b/figures/sankey5_5.png differ
diff --git a/figures/sankey6.png b/figures/sankey6.png
index 5cadbe9..f277d10 100644
Binary files a/figures/sankey6.png and b/figures/sankey6.png differ
diff --git a/figures/sankey6_1.png b/figures/sankey6_1.png
index a273706..99f4985 100644
Binary files a/figures/sankey6_1.png and b/figures/sankey6_1.png differ
diff --git a/figures/sankey6_10.png b/figures/sankey6_10.png
index d047abe..d659646 100644
Binary files a/figures/sankey6_10.png and b/figures/sankey6_10.png differ
diff --git a/figures/sankey6_2.png b/figures/sankey6_2.png
index e0fb681..2a0edf6 100644
Binary files a/figures/sankey6_2.png and b/figures/sankey6_2.png differ
diff --git a/figures/sankey6_3.png b/figures/sankey6_3.png
index 40d25e1..2251bcb 100644
Binary files a/figures/sankey6_3.png and b/figures/sankey6_3.png differ
diff --git a/figures/sankey6_4.png b/figures/sankey6_4.png
index 84d8278..37fd5b5 100644
Binary files a/figures/sankey6_4.png and b/figures/sankey6_4.png differ
diff --git a/figures/sankey6_5.png b/figures/sankey6_5.png
index 76133fa..ebf2f8b 100644
Binary files a/figures/sankey6_5.png and b/figures/sankey6_5.png differ
diff --git a/figures/sankey6_6.png b/figures/sankey6_6.png
index d5580e0..0e51cbf 100644
Binary files a/figures/sankey6_6.png and b/figures/sankey6_6.png differ
diff --git a/figures/sankey6_7.png b/figures/sankey6_7.png
index 2065cc7..623a027 100644
Binary files a/figures/sankey6_7.png and b/figures/sankey6_7.png differ
diff --git a/figures/sankey6_8.png b/figures/sankey6_8.png
index 8b6a5fa..f1b593d 100644
Binary files a/figures/sankey6_8.png and b/figures/sankey6_8.png differ
diff --git a/figures/sankey6_9.png b/figures/sankey6_9.png
index e4da137..431be02 100644
Binary files a/figures/sankey6_9.png and b/figures/sankey6_9.png differ
diff --git a/figures/sankey6_9_1.png b/figures/sankey6_9_1.png
new file mode 100644
index 0000000..c1c7d98
Binary files /dev/null and b/figures/sankey6_9_1.png differ
diff --git a/figures/sankey7.png b/figures/sankey7.png
index 8e67e34..dabd6c3 100644
Binary files a/figures/sankey7.png and b/figures/sankey7.png differ
diff --git a/figures/sankey8_1.png b/figures/sankey8_1.png
index 930ef60..ac93c21 100644
Binary files a/figures/sankey8_1.png and b/figures/sankey8_1.png differ
diff --git a/figures/sankey8_2.png b/figures/sankey8_2.png
index 48635df..d995451 100644
Binary files a/figures/sankey8_2.png and b/figures/sankey8_2.png differ
diff --git a/figures/sankey8_3.png b/figures/sankey8_3.png
index 6b8f03d..37c2168 100644
Binary files a/figures/sankey8_3.png and b/figures/sankey8_3.png differ
diff --git a/figures/sankey8_4.png b/figures/sankey8_4.png
index 44e26c6..703840e 100644
Binary files a/figures/sankey8_4.png and b/figures/sankey8_4.png differ
diff --git a/figures/sankey9_1.png b/figures/sankey9_1.png
index b692369..f792561 100644
Binary files a/figures/sankey9_1.png and b/figures/sankey9_1.png differ
diff --git a/figures/sankey9_2.png b/figures/sankey9_2.png
index 0f2b63b..40b209b 100644
Binary files a/figures/sankey9_2.png and b/figures/sankey9_2.png differ
diff --git a/installation/sankey.ado b/installation/sankey.ado
index f7e62f5..ac3babd 100644
--- a/installation/sankey.ado
+++ b/installation/sankey.ado
@@ -1,6 +1,7 @@
-*! sankey v1.61 (22 Jul 2023)
+*! sankey v1.7 (06 Nov 2023)
*! Asjad Naqvi (asjadnaqvi@gmail.com)
+*v1.7 (06 Nov 2023): fix valcond() dropping labels in bars, added percent (still in beta), add ctitlepos() option. minor cleanups
*v1.61 (22 Jul 2023): Adding saving() option. minor fixes
*v1.6 (11 Jun 2023): Major rewrite of the core routines. Labels added. twp sorts added. Program is faster.
*v1.52 (29 May 2023): Add option where wwn flows are considered stock
@@ -28,13 +29,14 @@ version 15
syntax varlist(numeric max=1) [if] [in], From(varname) To(varname) by(varname) ///
[ palette(string) smooth(numlist >=1 <=8) gap(real 5) RECENter(string) colorby(string) alpha(real 75) ] ///
[ LABAngle(string) LABSize(string) LABPOSition(string) LABGap(string) SHOWTOTal ] ///
- [ VALSize(string) VALCONDition(real 0) format(string) VALGap(string) NOVALues ] ///
+ [ VALSize(string) VALCONDition(real 0) format(string) VALGap(string) NOVALues ] ///
[ LWidth(string) LColor(string) ] ///
[ offset(real 0) LABColor(string) ] /// // added v1.1
- [ BOXWidth(string) ] /// // added v1.3
- [ wrap(real 7) CTITLEs(string asis) CTGap(real -5) CTSize(real 2.5) colorvar(varname) colorvarmiss(string) colorboxmiss(string) ] /// // v1.4 options
+ [ BOXWidth(string) ] /// // added v1.3
+ [ wrap(real 7) CTITLEs(string asis) CTGap(real -10) CTSize(real 2.5) colorvar(varname) colorvarmiss(string) colorboxmiss(string) ] /// // v1.4 options
[ valprop labprop valscale(real 0.33333) labscale(real 0.3333) NOVALRight NOVALLeft NOLABels ] /// // v1.5
- [ stock sort1(string) sort2(string) ] /// // v1.6
+ [ stock sort1(string) sort2(string) ] /// // v1.6
+ [ percent ctpos(string) ] /// // v1.7
[ title(passthru) subtitle(passthru) note(passthru) scheme(passthru) name(passthru) xsize(passthru) ysize(passthru) saving(passthru) ]
@@ -131,7 +133,7 @@ preserve
cap ren `by' xcut
- egen layer = group(xcut)
+ egen layer = group(xcut)
replace layer = layer - 1
ren `from' var1
@@ -140,6 +142,24 @@ preserve
gen val2 = val1
+
+ if "`percent'" != "" { // suggestion by Mortiz Poll
+ tempvar aux1 aux2 total
+
+ bysort layer (var1 var2): egen double `total' = sum(val1)
+ replace val1 = (val1 / `total') * 100
+
+ bysort var1 layer clrlvl: egen double `aux1' = sum(val2)
+ replace `aux1' = 0 if clrlvl == 0
+ bysort layer: egen double `aux2' = sum(`aux1')
+ replace val2 = (val2 / `aux2') * 100
+
+ gsort layer val1 val2
+ }
+
+
+
+
gen id = _n
@@ -167,18 +187,18 @@ preserve
sort layer2 var marker
- bysort layer2 var: egen val_out_temp = sum(val) if marker==1 // how much value is sent out
- bysort layer2 var: egen val_in_temp = sum(val) if marker==2 & markme!=1 // how many value comes in
+ bysort layer2 var: egen double val_out_temp = sum(val) if marker==1 // how much value is sent out
+ bysort layer2 var: egen double val_in_temp = sum(val) if marker==2 & markme!=1 // how many value comes in
- bysort layer2 var: egen val_out = max(val_out_temp)
- bysort layer2 var: egen val_in = max(val_in_temp)
+ bysort layer2 var: egen double val_out = max(val_out_temp)
+ bysort layer2 var: egen double val_in = max(val_in_temp)
drop *temp
sort layer var marker
recode val_in val_out (.=0)
- egen height = rowmax(val_in val_out) // this is the maximum height for each category for each group.
+ egen double height = rowmax(val_in val_out) // this is the maximum height for each category for each group.
// sort by name or value
@@ -499,11 +519,23 @@ preserve
if "`labgap'" == "" local labgap 0
if "`valsize'" == "" local valsize 1.5
if "`valgap'" == "" local valgap 2
- if "`format'" == "" local format "%12.0f"
if "`boxwidth'" == "" local boxwidth 3.2
if "`colorboxmiss'" == "" local colorboxmiss gs10
+ if "`format'" == "" {
+ if "`percent'" != "" {
+ local format "%5.2f"
+
+ }
+ else {
+ local format "%12.0f"
+ }
+ }
+
+
+
+
format val `format'
@@ -640,19 +672,26 @@ preserve
summ labwgt if id==`x', meanonly
local labw = r(mean)
- local boxlabel `boxlabel' (scatter ymid layer2 if tag_spike==1 & height >= `valcondition' & id==`x', msymbol(none) mlabel(lab2) mlabsize(`labw') mlabpos(`labposition') mlabgap(`labgap') mlabangle(`labangle') mlabcolor(`labcolor')) ///
+ local boxlabel `boxlabel' (scatter ymid layer2 if tag_spike==1 & id==`x', msymbol(none) mlabel(lab2) mlabsize(`labw') mlabpos(`labposition') mlabgap(`labgap') mlabangle(`labangle') mlabcolor(`labcolor')) ///
}
}
else {
- local boxlabel (scatter ymid layer2 if tag_spike==1 & val >= `valcondition', msymbol(none) mlabel(lab2) mlabsize(`labsize') mlabpos(`labposition') mlabgap(`labgap') mlabangle(`labangle') mlabcolor(`labcolor')) ///
+ local boxlabel (scatter ymid layer2 if tag_spike==1 , msymbol(none) mlabel(lab2) mlabsize(`labsize') mlabpos(`labposition') mlabgap(`labgap') mlabangle(`labangle') mlabcolor(`labcolor')) ///
}
}
-
+
+ local flowval val
+
+ if "`percent'" != "" {
+ gen valper = string(val, "`format'") + "%" if (marker==1 | marker==2)
+ local flowval valper
+ }
+
**** arc labels
@@ -668,12 +707,12 @@ preserve
if "`valprop'" == "" {
if "`novalleft'" == "" {
- local values `values' (scatter arcmid layer2 if val >= `valcondition' & marker==1, msymbol(none) mlabel(val) mlabsize(`valsize') mlabpos(3) mlabgap(`valgap') mlabcolor(`labcolor')) ///
+ local values `values' (scatter arcmid layer2 if val >= `valcondition' & marker==1, msymbol(none) mlabel(`flowval') mlabsize(`valsize') mlabpos(3) mlabgap(`valgap') mlabcolor(`labcolor')) ///
}
if "`novalright'" == "" {
- local values `values' (scatter arcmid layer2 if val >= `valcondition' & marker==2, msymbol(none) mlabel(val) mlabsize(`valsize') mlabpos(9) mlabgap(`valgap') mlabcolor(`labcolor')) ///
+ local values `values' (scatter arcmid layer2 if val >= `valcondition' & marker==2, msymbol(none) mlabel(`flowval') mlabsize(`valsize') mlabpos(9) mlabgap(`valgap') mlabcolor(`labcolor')) ///
}
}
@@ -704,12 +743,21 @@ preserve
if `"`ctitles'"' != "" {
+ if "`ctpos'" == "bot" | "`ctpos'" == "" {
+ local cty = -5 + `ctgap'
+ }
+
+ if "`ctpos'" == "top" {
+ summ y2, meanonly
+ local cty = `r(max)' + `ctgap'
+ }
+
local clabs `"`ctitles'"'
local len : word count `clabs'
gen title_x = .
- gen title_y = `ctgap' in 1/`len'
+ gen title_y = `cty' in 1/`len'
gen title_name = ""
@@ -724,7 +772,7 @@ preserve
**** column labels
if `"`ctitles'"' != "" {
- local lvllab (scatter title_y title_x, msymbol(none) mlabel(title_name) mlabpos(0) mlabsize(`ctsize')) ///
+ local lvllab (scatter title_y title_x, msymbol(none) mlabel(title_name) mcolor(black) mlabpos(0) mlabsize(`ctsize')) ///
}
diff --git a/installation/sankey.pkg b/installation/sankey.pkg
index a2b15c1..a8daa36 100644
--- a/installation/sankey.pkg
+++ b/installation/sankey.pkg
@@ -1,4 +1,4 @@
-v 1.61
+v 1.7
d {bf:SANKEY}: A Stata package for sankey plots.
d See {bf:help sankey} after installation.
d
@@ -8,9 +8,9 @@ d KW: Stata
d KW: graphs
d KW: sankey
d
-d Distribution-Date: 20230525
+d Distribution-Date: 20231106
d
-d This version: 22 Jul 2023
+d This version: 06 Nov 2023
d First version: 08 Dec 2022
d License: MIT
d
diff --git a/installation/sankey.sthlp b/installation/sankey.sthlp
index 4540bfb..63c82c4 100644
--- a/installation/sankey.sthlp
+++ b/installation/sankey.sthlp
@@ -1,7 +1,7 @@
{smcl}
-{* 22Jul2023}{...}
+{* 06Nov2023}{...}
{hi:help sankey}{...}
-{right:{browse "https://github.com/asjadnaqvi/stata-sankey":sankey v1.61 (GitHub)}}
+{right:{browse "https://github.com/asjadnaqvi/stata-sankey":sankey v1.7 (GitHub)}}
{hline}
@@ -12,11 +12,11 @@
{cmd:sankey} {it:value} {ifin}, {cmdab:f:rom}({it:var}) {cmdab:t:o}({it:var}) {cmd:by}({it:var})
{cmd:[} {cmd:palette}({it:str}) {cmd:colorby}({it:layer}|{it:level}) {cmd:colorvar}({it:var}) {cmd:stock} {cmd:colorvarmiss}({it:str}) {cmd:colorboxmiss}({it:str})
- {cmd:smooth}({it:1-8}) {cmd:gap}({it:num}) {cmdab:recen:ter}({it:mid}|{it:bot}|{it:top}) {cmdab:ctitle:s}({it:list}) {cmdab:ctg:ap}({it:num}) {cmdab:cts:ize}({it:num})
+ {cmd:smooth}({it:1-8}) {cmd:gap}({it:num}) {cmdab:recen:ter}({it:mid}|{it:bot}|{it:top}) {cmdab:ctitle:s}({it:list}) {cmdab:ctg:ap}({it:num}) {cmdab:cts:ize}({it:num}) {cmdab:ctpos:ition}({it:bot}|{it:top})
{cmdab:laba:ngle}({it:str}) {cmdab:labs:ize}({it:str}) {cmdab:labpos:ition}({it:str}) {cmdab:labg:ap}({it:str}) {cmdab:showtot:al} {cmd:labprop} {cmd:labscale}({it:num})
{cmdab:vals:ize}({it:str}) {cmdab:valcond:ition}({it:num}) {cmd:format}({it:str}) {cmdab:valg:ap}({it:str}) {cmdab:noval:ues} {cmd:valprop} {cmd:valscale}({it:num})
{cmdab:novalr:ight} {cmdab:novall:eft} {cmdab:nolab:els} {cmd:sort1}({it:value}|{it:name}[{it:, reverse}]) {cmd:sort2}({it:value}|{it:order}[{it:, reverse}])
- {cmdab:lw:idth}({it:str}) {cmdab:lc:olor}({it:str}) {cmd:alpha}({it:num}) {cmd:offset}({it:num}) {cmdab:boxw:idth}({it:str})
+ {cmdab:lw:idth}({it:str}) {cmdab:lc:olor}({it:str}) {cmd:alpha}({it:num}) {cmd:offset}({it:num}) {cmdab:boxw:idth}({it:str}) {cmd:percent}
{cmd:title}({it:str}) {cmd:subtitle}({it:str}) {cmd:note}({it:str}) {cmd:scheme}({it:str}) {cmd:name}({it:str}) {cmd:xsize}({it:num}) {cmd:ysize}({it:num}) {cmd:saving}({it:str}) {cmd:]}
{p 4 4 2}
@@ -70,32 +70,35 @@ Default value is {opt alpha(75)} for 75% transparency.{p_end}
{p2coldent : {opt lc:olor(str)}}The outline color of the area fills. Default is {opt lc(white)}.{p_end}
+{p2coldent : {opt percent}} {bf:Beta option:} Covert flow values into percentage share of category bars. Might give messy output if outflows are greater than inflows.
+Use cautiously.{p_end}
-{p 4 4 2}{ul:{it:Boxes}}
-{p2coldent : {opt labs:ize(str)}}The size of the category labels. Default is {opt labs(2)}.{p_end}
+{p 4 4 2}{ul:{it:Bars}}
-{p2coldent : {opt labprop}}Scale the labels based on the relative stocks.{p_end}
+{p2coldent : {opt labs:ize(str)}}The size of the bar labels. Default is {opt labs(2)}.{p_end}
-{p2coldent : {opt labscale(num)}}Scale factor of {opt labprop}. Default value is {opt labscale(0.3333)}. Advance option, use carefully.{p_end}
+{p2coldent : {opt labprop}}Scale the bar labels based on the relative stocks.{p_end}
-{p2coldent : {opt labscale(num)}}Scaling factor of the labels. Default is {opt labscale(0.3333)}. Changing the value will change the relative
-weights of the smaller and higher values. This is an advanced option therefore use with caution.{p_end}
+{p2coldent : {opt labscale(num)}}Scale factor of {opt labprop}. Default value is {opt labscale(0.3333)}. Advance option, use carefully.{p_end}
-{p2coldent : {opt laba:ngle(str)}}The angle of the category labels. Default is {opt laba(90)} for vertical labels.{p_end}
+{p2coldent : {opt laba:ngle(str)}}The angle of the bar labels. Default is {opt laba(90)} for vertical labels.{p_end}
-{p2coldent : {opt labc:olor(str)}}The color of the category labels. Default is {opt labc(black)}.{p_end}
+{p2coldent : {opt labc:olor(str)}}The color of the bar labels. Default is {opt labc(black)}.{p_end}
-{p2coldent : {opt nolab:els}}Hide the box labels.{p_end}
+{p2coldent : {opt nolab:els}}Hide the bar labels.{p_end}
-{p2coldent : {opt labpos:ition(str)}}The position of the category labels. Default is {opt labpos(0)} for centered.{p_end}
+{p2coldent : {opt labpos:ition(str)}}The position of the bar labels. Default is {opt labpos(0)} for centered.{p_end}
-{p2coldent : {opt labg:ap(str)}}The gap of the category labels from the mid point of the wedges. Default is {opt labg(0)} for no gap.
+{p2coldent : {opt labg:ap(str)}}The gap of the bars from the mid point. Default is {opt labg(0)} for no gap.
If the label angle is change to horitzontal or the label position is changed from 0, then {opt labg()} can be used to fine-tune the placement.{p_end}
-{p2coldent : {opt showtot:al}}Display the category totals on the node boxes.{p_end}
+{p2coldent : {opt showtot:al}}Display the category totals on the bars.{p_end}
-{p2coldent : {opt boxw:idth(str)}}Width of the node boxes. Default is {opt boxw(3.2)}.{p_end}
+{p2coldent : {opt boxw:idth(str)}}Width of the bars. Default is {opt boxw(3.2)}.{p_end}
+
+{p2coldent : {opt labscale(num)}}Scaling factor of the labels. Default is {opt labscale(0.3333)}. Changing the value will change the relative
+weights of the smaller and higher values. This is an advanced option therefore use with caution.{p_end}
{p 4 4 2}{ul:{it:Link values}}
@@ -125,7 +128,9 @@ names as {opt ctitle("My name1" "My name2" "My name3" "...")}. Please make sure
{p2coldent : {opt cts:ize(num)}}The size of the column titles. Default is {opt cts(2.5)}.{p_end}
-{p2coldent : {opt ctg:ap(num)}}The gap of the column titles. Default is {opt ctg(-5)}.{p_end}
+{p2coldent : {opt ctg:ap(num)}}The gap of the column titles. Default is {opt ctg(0)}.{p_end}
+
+{p2coldent : {opt ctpos:ition(bot|top)}}The position of column titles. No option defaults to {opt ctpos(bot)}. Might still need adjustment via {opt ctgap()}.{p_end}
{p 4 4 2}{ul:{it:Miscellaneous}}
@@ -151,8 +156,8 @@ The {browse "http://repec.sowi.unibe.ch/stata/palettes/index.html":palette} pack
{stata ssc install palettes, replace}
{stata ssc install colrspace, replace}
-Even if you have these installed, it is highly recommended to update the dependencies:
-{stata ado update, update}
+Even if you have these installed, it is highly recommended to regularly check for updates.
+
{title:Examples}
@@ -163,6 +168,7 @@ See {browse "https://github.com/asjadnaqvi/stata-sankey":GitHub} for examples.
{title:Version history}
+- {bf:1.7} : Fixed {opt valcond()} dropping bar values, and fixed ctitles color to black. Added {opt percent} (beta), {opt ctpos()}.
- {bf:1.61} : Adding saving() option.
- {bf:1.6} : Rewrite of core routines. {opt sortby()} split into {opt sort1()} and {opt sort2()}. New option {opt stock} added.
- {bf:1.51} : Add a string check for {opt from()} and {opt by()} variables.
@@ -177,8 +183,8 @@ See {browse "https://github.com/asjadnaqvi/stata-sankey":GitHub} for examples.
{title:Package details}
-Version : {bf:sankey} v1.61
-This release : 22 Jul 2023
+Version : {bf:sankey} v1.7
+This release : 06 Nov 2023
First release: 08 Dec 2022
Repository : {browse "https://github.com/asjadnaqvi/stata-sankey":GitHub}
Keywords : Stata, graph, sankey
diff --git a/installation/stata.toc b/installation/stata.toc
index a1a5653..61badde 100644
--- a/installation/stata.toc
+++ b/installation/stata.toc
@@ -1,7 +1,7 @@
-v 1.61
+v 1.7
d 'SANKEY': A Stata package for Sankey plots
d
-d Distribution-Date: 20230722
+d Distribution-Date: 20231106
d
d Asjad Naqvi
d asjadnaqvi@gmail.com