diff --git a/CITATION.cff b/CITATION.cff
index 65d1d98..d9c4b03 100644
--- a/CITATION.cff
+++ b/CITATION.cff
@@ -3,6 +3,6 @@ authors:
- family-names: "Naqvi"
given-names: "Asjad"
title: "Stata package ``bimap''"
-version: 1.62
-date-released: 2023-05-19
+version: 1.7
+date-released: 2023-06-15
url: "https://github.com/asjadnaqvi/stata-bimap"
diff --git a/README.md b/README.md
index eabe60f..3d97660 100644
--- a/README.md
+++ b/README.md
@@ -8,7 +8,7 @@
---
-# bimap v1.62
+# bimap v1.7
This package provides the ability to draw bi-variate maps in Stata. It is based on the [Bi-variate maps Guide](https://medium.com/the-stata-guide/stata-graphs-bi-variate-maps-b1e96dd4c2be).
@@ -22,7 +22,7 @@ The package can be installed from SSC (**v1.61**):
ssc install bimap, replace
```
-Or it can be installed from GitHub (**v1.62**):
+Or it can be installed from GitHub (**v1.7**):
```
net install bimap, from("https://raw.githubusercontent.com/asjadnaqvi/stata-bimap/main/installation/") replace
@@ -64,10 +64,11 @@ The syntax for **v1.61** is as follows:
```
bimap vary varx [if] [in], [ palette(name) reverse clr0(str) clrx(str) clry(str) clrsaturate(num)
cut(pctile|equal) cutx(numlist) cuty(numlist) binsproper bins(num >=2) binx(num >=2) biny(num >=2)
- values count percent showlegend ocolor(str) osize(str) ndocolor(str) ndfcolor(str)
+ values count percent showlegend ocolor(str) osize(str) ndocolor(str) ndfcolor(str) xdiscrete ydiscrete
textx(str) texty(str) textgap(num) textlabsize(num) textsize(num) formatx(str) formaty(str) xscale(num) yscale(num)
polygon(options) line(options) point(options) label(options) arrow(options) diagram(options) scalebar(options)
title(str) subtitle(str) note(str) name(str) scheme(str) ]
+
```
See the help file `help bimap` for details.
@@ -123,8 +124,6 @@ spmap share_hisp using county_shp2, id(_ID) clm(custom) clb(0(10)100) fcolor(Hea
-
-
Let's test the `bimap` command:
```
@@ -388,6 +387,60 @@ bimap share_hisp share_afam using county_shp2, cut(pctile) palette(orangeblue) b
+
+### showing proper bins (v1.6)
+
+```
+bimap share_hisp share_afam using county_shp2, cut(pctile) palette(orangeblue) bins(3) binsproper ///
+ note("Data from the US Census Bureau.") ///
+ texty("Share of Hispanics") textx("Share of African Americans") texts(3.5) textlabs(3) values count ///
+ ocolor() osize(none) ///
+ polygon(data("state_shp2") ocolor(black) osize(0.2))
+```
+
+
+
+
+### discrete variables (v1.7)
+
+Let's make some variables discrete:
+
+```
+xtile discx = share_afam, n(4)
+gen discy = share_hisp < 10
+
+
+lab de dx 1 "Catx 1" 2 "Catx 2" 3 "Catx 3" 4 "Catx 4"
+lab val discx dx
+
+lab de dy 0 "Caty 0" 1 "Caty 1"
+lab val discy dy
+
+
+tab discy discx, m
+```
+
+We can also now declare these variables as discrete while using `bimap` in any combination:
+
+```
+bimap discy share_afam using county_shp2, palette(yellowblue) values count ydisc
+```
+
+
+
+
+```
+bimap share_hisp discx using county_shp2, palette(yellowblue) values count xdisc
+```
+
+
+
+```
+bimap discy discx using county_shp2, palette(yellowblue) values count xdisc ydisc
+```
+
+
+
## Feedback
Please open an [issue](https://github.com/asjadnaqvi/stata-bimap/issues) to report errors, feature enhancements, and/or other requests.
@@ -395,10 +448,12 @@ Please open an [issue](https://github.com/asjadnaqvi/stata-bimap/issues) to repo
## Change log
+**v1.7 (15 Jun 2023)**
+- Added two new options `xdiscrete` and `ydiscrete` to support discrete variables.
+
**v1.62 (19 May 2023)**
- Fixed bugs in legend labels (reported by Kit Baum). Minor improvements.
-
**v1.61 (12 Apr 2023)**
- Fixed a major bug in the legend. The boxes were not rescaling properly.
diff --git a/figures/bimap10.png b/figures/bimap10.png
index a8b4d35..498bb5e 100644
Binary files a/figures/bimap10.png and b/figures/bimap10.png differ
diff --git a/figures/bimap11.png b/figures/bimap11.png
index f3ff3e0..ac04058 100644
Binary files a/figures/bimap11.png and b/figures/bimap11.png differ
diff --git a/figures/bimap12.png b/figures/bimap12.png
index 612f65b..a8c8bf0 100644
Binary files a/figures/bimap12.png and b/figures/bimap12.png differ
diff --git a/figures/bimap13.png b/figures/bimap13.png
index e6c1c9e..dee2fdd 100644
Binary files a/figures/bimap13.png and b/figures/bimap13.png differ
diff --git a/figures/bimap14.png b/figures/bimap14.png
index 96ceda3..e1dc2d6 100644
Binary files a/figures/bimap14.png and b/figures/bimap14.png differ
diff --git a/figures/bimap15.png b/figures/bimap15.png
index 92793f2..c84278c 100644
Binary files a/figures/bimap15.png and b/figures/bimap15.png differ
diff --git a/figures/bimap16.png b/figures/bimap16.png
index 5aabb1e..e39fa3f 100644
Binary files a/figures/bimap16.png and b/figures/bimap16.png differ
diff --git a/figures/bimap17.png b/figures/bimap17.png
index e371ea8..d51abd6 100644
Binary files a/figures/bimap17.png and b/figures/bimap17.png differ
diff --git a/figures/bimap18.png b/figures/bimap18.png
index 834f4bf..b3704b2 100644
Binary files a/figures/bimap18.png and b/figures/bimap18.png differ
diff --git a/figures/bimap19.png b/figures/bimap19.png
index 22ce5a6..83d092a 100644
Binary files a/figures/bimap19.png and b/figures/bimap19.png differ
diff --git a/figures/bimap2.png b/figures/bimap2.png
index b272f0a..1cb5c05 100644
Binary files a/figures/bimap2.png and b/figures/bimap2.png differ
diff --git a/figures/bimap20.png b/figures/bimap20.png
index aea8a59..4da04c2 100644
Binary files a/figures/bimap20.png and b/figures/bimap20.png differ
diff --git a/figures/bimap21.png b/figures/bimap21.png
index b21489d..9dad8a8 100644
Binary files a/figures/bimap21.png and b/figures/bimap21.png differ
diff --git a/figures/bimap22.png b/figures/bimap22.png
new file mode 100644
index 0000000..b3f8d29
Binary files /dev/null and b/figures/bimap22.png differ
diff --git a/figures/bimap23_1.png b/figures/bimap23_1.png
new file mode 100644
index 0000000..eaadebf
Binary files /dev/null and b/figures/bimap23_1.png differ
diff --git a/figures/bimap23_2.png b/figures/bimap23_2.png
new file mode 100644
index 0000000..4b55d5d
Binary files /dev/null and b/figures/bimap23_2.png differ
diff --git a/figures/bimap23_3.png b/figures/bimap23_3.png
new file mode 100644
index 0000000..c87ee1d
Binary files /dev/null and b/figures/bimap23_3.png differ
diff --git a/figures/bimap2_1.png b/figures/bimap2_1.png
index c241cda..1753552 100644
Binary files a/figures/bimap2_1.png and b/figures/bimap2_1.png differ
diff --git a/figures/bimap2_1_1.png b/figures/bimap2_1_1.png
index 7a2e9eb..7db214b 100644
Binary files a/figures/bimap2_1_1.png and b/figures/bimap2_1_1.png differ
diff --git a/figures/bimap2_2.png b/figures/bimap2_2.png
index 990f6a7..14295c1 100644
Binary files a/figures/bimap2_2.png and b/figures/bimap2_2.png differ
diff --git a/figures/bimap3_1.png b/figures/bimap3_1.png
index 0d82b09..d3f5aa3 100644
Binary files a/figures/bimap3_1.png and b/figures/bimap3_1.png differ
diff --git a/figures/bimap3_10.png b/figures/bimap3_10.png
index c614b63..8de0da7 100644
Binary files a/figures/bimap3_10.png and b/figures/bimap3_10.png differ
diff --git a/figures/bimap3_11.png b/figures/bimap3_11.png
index 89db273..714483f 100644
Binary files a/figures/bimap3_11.png and b/figures/bimap3_11.png differ
diff --git a/figures/bimap3_12.png b/figures/bimap3_12.png
index 4bd330b..9edf9bc 100644
Binary files a/figures/bimap3_12.png and b/figures/bimap3_12.png differ
diff --git a/figures/bimap3_13.png b/figures/bimap3_13.png
index 4cd2777..d7d2f10 100644
Binary files a/figures/bimap3_13.png and b/figures/bimap3_13.png differ
diff --git a/figures/bimap3_2.png b/figures/bimap3_2.png
index b214c0b..6818df8 100644
Binary files a/figures/bimap3_2.png and b/figures/bimap3_2.png differ
diff --git a/figures/bimap3_3.png b/figures/bimap3_3.png
index b0715e4..d83b3b4 100644
Binary files a/figures/bimap3_3.png and b/figures/bimap3_3.png differ
diff --git a/figures/bimap3_4.png b/figures/bimap3_4.png
index 4c24666..9641769 100644
Binary files a/figures/bimap3_4.png and b/figures/bimap3_4.png differ
diff --git a/figures/bimap3_5.png b/figures/bimap3_5.png
index d5c10e2..6df32c9 100644
Binary files a/figures/bimap3_5.png and b/figures/bimap3_5.png differ
diff --git a/figures/bimap3_6.png b/figures/bimap3_6.png
index a867856..7c8d482 100644
Binary files a/figures/bimap3_6.png and b/figures/bimap3_6.png differ
diff --git a/figures/bimap3_7.png b/figures/bimap3_7.png
index 30d72cc..dbc5c16 100644
Binary files a/figures/bimap3_7.png and b/figures/bimap3_7.png differ
diff --git a/figures/bimap3_8.png b/figures/bimap3_8.png
index a01c37a..4cc8b7f 100644
Binary files a/figures/bimap3_8.png and b/figures/bimap3_8.png differ
diff --git a/figures/bimap3_9.png b/figures/bimap3_9.png
index 3781f98..992d71f 100644
Binary files a/figures/bimap3_9.png and b/figures/bimap3_9.png differ
diff --git a/figures/bimap4.png b/figures/bimap4.png
index 93724b0..5feca9e 100644
Binary files a/figures/bimap4.png and b/figures/bimap4.png differ
diff --git a/figures/bimap6.png b/figures/bimap6.png
index da30a12..e1e5af3 100644
Binary files a/figures/bimap6.png and b/figures/bimap6.png differ
diff --git a/figures/bimap7.png b/figures/bimap7.png
index 4cff313..d550727 100644
Binary files a/figures/bimap7.png and b/figures/bimap7.png differ
diff --git a/figures/bimap9.png b/figures/bimap9.png
index 3032117..8921f62 100644
Binary files a/figures/bimap9.png and b/figures/bimap9.png differ
diff --git a/figures/bimap9_0.png b/figures/bimap9_0.png
index ed97faa..71173c3 100644
Binary files a/figures/bimap9_0.png and b/figures/bimap9_0.png differ
diff --git a/installation/bimap.ado b/installation/bimap.ado
index 82302ab..7e00be0 100644
--- a/installation/bimap.ado
+++ b/installation/bimap.ado
@@ -1,6 +1,7 @@
-*! bimap v1.62 (19 May 2023)
+*! bimap v1.62 (15 Jun 2023)
*! Asjad Naqvi (asjadnaqvi@gmail.com)
+* v1.7 (15 Jun 2023): added support for binary variables: xdiscrete, ydiscrete
* v1.62 (19 May 2023): Fix to legend labels and sizes. Minor improvements.
* v1.61 (12 Apr 2023): Fix to legend box and label rescaling.
* v1.6 (17 Mar 2023): Colors are now dynamically generated for any number of bins. several new options to control colors, bins, saturation, labels
@@ -24,6 +25,10 @@
* https://medium.com/the-stata-guide/stata-graphs-bi-variate-maps-b1e96dd4c2be
+// add checks for number of bins in xdisc, ydisc
+// pass on values labels correctly
+
+
cap program drop bimap
@@ -41,7 +46,8 @@ version 15
[ cutx(numlist min=1) cuty(numlist min=1) SHOWLEGend ] /// // 1.4 updates
[ LEGend(passthru) legenda(passthru) LEGStyle(passthru) LEGJunction(passthru) LEGCount(passthru) LEGOrder(passthru) LEGTitle(passthru) ] /// // 1.4 legend controls as passthru
[ arrow(passthru) diagram(passthru) scalebar(passthru) ] /// // 1.5
- [ bins(numlist min=1 >=2) binx(numlist min=1 >=2) biny(numlist min=1 >=2) reverse clr0(string) clrx(string) clry(string) CLRSATurate(real 6) binsproper FORMATVal(string) VALLABSize(string) ] // 1.6
+ [ bins(numlist min=1 >=2) binx(numlist min=1 >=2) biny(numlist min=1 >=2) reverse clr0(string) clrx(string) clry(string) CLRSATurate(real 6) binsproper FORMATVal(string) VALLABSize(string) ] /// // 1.6
+ [ XDISCrete YDISCrete ] // v1.7 options
if (substr(reverse("`using'"),1,4) != "atd.") local using "`using'.dta" // from spmap to check for extension
@@ -89,13 +95,13 @@ version 15
- if "`bins'"=="" local bins 3
+ if "`bins'"=="" local bins 3 // default
***** Get the cuts
qui {
- preserve
+ preserve
keep if `touse'
tempvar cat_`var1' cat_`var2'
@@ -220,37 +226,78 @@ qui {
if "`biny'" == "" local biny = `bins'
- if "`cut'" == "pctile" {
-
- xtile `cat_`var1'' = `var1', n(`binx')
- xtile `cat_`var2'' = `var2', n(`biny')
+ if "`xdiscrete'" != "" {
- _pctile `var1', n(`binx')
-
- local binx0 = `binx' - 1
+ levelsof `var1'
+ local xdiscli `r(levels)'
+ egen `cat_`var1'' = group(`var1')
+
+ levelsof `cat_`var1''
- forval i = 1/`binx0' {
- local xlist `xlist' `r(r`i')'
+ if r(r) > 10 {
+ di as err "Maximum categories allowed are 10. `var1' has `r(r)' categories."
+ exit 198
}
- local xlist `xmin' `xlist' `xmax'
+ local binx = r(r)
+ local xlist 0 `r(levels)'
+ local xlab: value label `var1'
+ }
+
+ if "`ydiscrete'" != "" {
+ levelsof `var2'
+ local ydiscli `r(levels)'
- _pctile `var2', n(`biny')
- local biny0 = `biny' - 1
+ egen `cat_`var2'' = group(`var2')
+
+ levelsof `cat_`var2''
+
+ if r(r) > 10 {
+ di as err "Maximum categories allowed are 10. `var2' has `r(r)' categories."
+ exit 198
+ }
- forval i = 1/`biny0' {
- local ylist `ylist' `r(r`i')'
- }
+ local biny = r(r)
+ local ylist 0 `r(levels)'
- local ylist `ymin' `ylist' `ymax'
+ local ylab: value label `var2'
+ }
+
+
+
+ if "`cut'" == "pctile" {
+ if "`xdiscrete'" == "" {
+ xtile `cat_`var1'' = `var1', n(`binx')
+ _pctile `var1', n(`binx')
+
+ local binx0 = `binx' - 1
+
+
+ forval i = 1/`binx0' {
+ local xlist `xlist' `r(r`i')'
+ }
+
+ local xlist `xmin' `xlist' `xmax'
+ }
+ if "`ydiscrete'" == "" {
+ xtile `cat_`var2'' = `var2', n(`biny')
+ _pctile `var2', n(`biny')
+ local biny0 = `biny' - 1
+
+ forval i = 1/`biny0' {
+ local ylist `ylist' `r(r`i')'
+ }
+
+ local ylist `ymin' `ylist' `ymax'
+ }
}
if "`cut'" == "equal" {
-
+ if "`xdiscrete'" == "" {
local xint = (`xmax' - `xmin') / `binx'
gen int `cat_`var1'' = .
@@ -262,7 +309,16 @@ qui {
replace `cat_`var1'' = `i' if inrange(`var1', `xstart', `xend')
}
-
+ local xlist = `xmin'
+ forval i = 1/`binx' {
+ local newval = `xmin' + `i' * `xint'
+ local xlist `xlist' `newval'
+ }
+ }
+
+
+
+ if "`ydiscrete'" == "" {
local yint = (`ymax' - `ymin') / `biny'
gen int `cat_`var2'' = .
@@ -275,26 +331,18 @@ qui {
}
- local xlist = `xmin'
- forval i = 1/`binx' {
- local newval = `xmin' + `i' * `xint'
- local xlist `xlist' `newval'
- }
-
local ylist = `ymin'
forval i = 1/`biny' {
local newval = `ymin' + `i' * `yint'
local ylist `ylist' `newval'
}
-
+ }
}
-
- *if "`cut'" == "custom" {
-
+
- if "`cutx'" != "" {
+ if "`cutx'" != "" & "`xdiscrete'"=="" {
local xlen : word count `cutx'
tokenize `cutx'
@@ -321,7 +369,7 @@ qui {
local binx = `xlen' + 1
}
- if "`cuty'" != "" {
+ if "`cuty'" != "" & "`ydiscrete'"=="" {
local ylen : word count `cuty'
tokenize `cuty'
@@ -346,14 +394,15 @@ qui {
}
// reset the bins
-
local biny = `ylen' + 1
}
-
+
sort `cat_`var1'' `cat_`var2''
+
+
tempvar grp_cut
gen `grp_cut' = .
@@ -376,7 +425,6 @@ qui {
}
}
-
***** store the cut-offs for labels
@@ -406,8 +454,6 @@ qui {
}
}
-
-
if "`polygon'" == "" {
local polyadd
@@ -461,9 +507,6 @@ qui {
local cutst = 9
}
-
- *colorpalette "`mycolors'", nograph
- *local colors `r(p)'
spmap `grp_cut' using "`using'", ///
id(_ID) clm(custom) clb(0(1)`cutst') fcolor("`colors'") ///
@@ -474,37 +517,56 @@ qui {
`arrow' `diagram' `scalebar' /// // v1.5 passthrus
name(_map, replace) nodraw
-
+
**************************
**** Legend *****
**************************
+
+
+
keep `var1' `var2'
ren `var2' ydot
ren `var1' xdot
- replace y = ydot / `ymax'
- replace x = xdot / `xmax'
+ summ xdot, meanonly
+ replace xdot = xdot / r(max)
+
+ summ ydot, meanonly
+ replace ydot = ydot / r(max)
+
// equal interval list (add option to bypass this and stick to the original distribution)
if "`binsproper'" == "" {
- local xint = (`xmax' - `xmin') / `binx'
- local yint = (`ymax' - `ymin') / `biny'
-
- local xcats = `xmin'
- forval i = 1/`binx' {
- local newval = `xmin' + `i' * `xint'
- local xcats `xcats' `newval'
+ if "`xdiscrete'"=="" {
+
+ local xint = (`xmax' - `xmin') / `binx'
+ local xcats = `xmin'
+
+ forval i = 1/`binx' {
+ local newval = `xmin' + `i' * `xint'
+ local xcats `xcats' `newval'
+ }
+ }
+ else {
+ local xcats `xlist'
}
-
- local ycats = `ymin'
- forval i = 1/`biny' {
- local newval = `ymin' + `i' * `yint'
- local ycats `ycats' `newval'
+
+ if "`ydiscrete'"=="" {
+ local yint = (`ymax' - `ymin') / `biny'
+ local ycats = `ymin'
+
+ forval i = 1/`biny' {
+ local newval = `ymin' + `i' * `yint'
+ local ycats `ycats' `newval'
+ }
+ }
+ else {
+ local ycats `ylist'
}
}
else {
@@ -512,10 +574,9 @@ qui {
local ycats `ylist'
}
-
+
/////
-
local xlen : word count `xcats'
local ylen : word count `ycats'
@@ -575,7 +636,6 @@ qui {
}
}
-
replace x = x / `xmax'
replace y = y / `ymax'
@@ -598,8 +658,6 @@ qui {
}
}
-
-
local marksym mycount
}
@@ -616,26 +674,60 @@ qui {
// markers
// for x-axis
- local xlen : word count `xcats'
- local ylen : word count `ycats'
-
- local z = 1
- forval i0 = 1/`xlen' {
- replace x_mark = `: word `i0' of `xcats'' / `xmax' in `z'
- replace x_val = `: word `i0' of `xlist'' in `z'
- local z = `z' + 1
+
+ if "`xdiscrete'"=="" {
+
+ local xlen : word count `xcats'
+
+ local z = 1
+ forval i0 = 1/`xlen' {
+ replace x_mark = `: word `i0' of `xcats'' / `xmax' in `z'
+ replace x_val = `: word `i0' of `xlist'' in `z'
+ local z = `z' + 1
+ }
+ }
+ else {
+ local xlen : word count `xdiscli'
+
+ local z = 1
+ forval i0 = 1/`xlen' {
+ replace x_mark = `: word `i0' of `xcats'' / `xmax' in `z'
+ replace x_val = `: word `i0' of `xdiscli'' in `z'
+ local z = `z' + 1
+ }
+ lab val x_val `xlab'
}
+
// for y-axis
- local z = 1
- forval i0 = 1/`ylen' {
- replace y_mark = `: word `i0' of `ycats'' / `ymax' in `z'
- replace y_val = `: word `i0' of `ylist'' in `z'
- local z = `z' + 1
- }
+
+ if "`ydiscrete'"=="" {
+
+ local ylen : word count `ycats'
+
+ local z = 1
+ forval i0 = 1/`ylen' {
+ replace y_mark = `: word `i0' of `ycats'' / `ymax' in `z'
+ replace y_val = `: word `i0' of `ylist'' in `z'
+ local z = `z' + 1
+ }
+ }
+ else {
+ local ylen : word count `ydiscli'
+
+ local z = 1
+ forval i0 = 1/`ylen' {
+ replace y_mark = `: word `i0' of `ycats'' / `ymax' in `z'
+ replace y_val = `: word `i0' of `ydiscli'' in `z'
+ local z = `z' + 1
+ }
+ lab val y_val `ylab'
+ }
+
// rescale x and y (0-1)
+
summ x, meanonly
replace x = (x - r(min)) / (r(max) - r(min))
replace x_mid = (x_mid - r(min)) / (r(max) - r(min))
@@ -647,8 +739,11 @@ qui {
replace y_mark = (y_mark - r(min)) / (r(max) - r(min))
- if "`formatx'" =="" local formatx "%5.1f"
- if "`formaty'" =="" local formaty "%5.1f"
+ if "`xdiscrete'"!="" replace x_mark = x_mark + ((1/`xlen')/2)
+ if "`ydiscrete'"!="" replace y_mark = y_mark + ((1/`ylen')/2)
+
+ if "`formatx'"=="" & "`xdiscrete'"=="" local formatx "%5.1f"
+ if "`formaty'"=="" & "`ydiscrete'"=="" local formaty "%5.1f"
format x_val `formatx'
@@ -684,7 +779,7 @@ qui {
replace labn = "`textx'" in 1
replace labx = -0.2 in 2
- replace laby = 0.8 in 2
+ replace laby = 0.55 in 2
replace labn = "`texty'" in 2
@@ -715,8 +810,7 @@ qui {
}
-
-
+
twoway ///
`boxes' ///
`xvals' ///
@@ -736,7 +830,7 @@ qui {
legend(off) ///
name(_legend, replace) nodraw
- restore
+ restore
********************
**** FINAL ****
@@ -752,6 +846,8 @@ qui {
}
+*/
+
end
diff --git a/installation/bimap.pkg b/installation/bimap.pkg
index 50602ac..8fe882a 100644
--- a/installation/bimap.pkg
+++ b/installation/bimap.pkg
@@ -1,4 +1,4 @@
-v 1.62
+v 1.7
d {bf:BIMAP}: Bi-variate maps
d
d
@@ -8,9 +8,9 @@ d KW: Stata
d KW: graphs
d KW: map
d KW: bivariate map
-d Distribution-Date: 20230519
+d Distribution-Date: 20230615
d
-d This version: 19 May 2023
+d This version: 15 Jun 2023
d First version: 08 Apr 2022
d License: MIT
d
diff --git a/installation/bimap.sthlp b/installation/bimap.sthlp
index 03896c6..1cbc3c3 100644
--- a/installation/bimap.sthlp
+++ b/installation/bimap.sthlp
@@ -1,7 +1,7 @@
{smcl}
-{* 19May2023}{...}
+{* 15Jun2023}{...}
{hi:help bimap}{...}
-{right:{browse "https://github.com/asjadnaqvi/stata-bimap":bimap v1.62 (GitHub)}}
+{right:{browse "https://github.com/asjadnaqvi/stata-bimap":bimap v1.7 (GitHub)}}
{hline}
@@ -17,7 +17,7 @@ Note that {cmd:bimap} only works if you have processed the shapefiles using Stat
{cmd:bimap} {it:vary varx} {ifin}, {cmd:[} {cmd:palette}({it:name}) reverse {cmd:clr0}({it:str}) {cmd:clrx}({it:str}) {cmd:clry}({it:str}) {cmdab:clrsat:urate}({it:num})
{cmd:cut}({it:pctile}|{it:equal}) {cmd:cutx}({it:numlist}) {cmd:cuty}({it:numlist}) {cmd:binsproper} {cmd:bins}({it:num >=2}) {cmd:binx}({it:num >=2}) {cmd:biny}({it:num >=2})
- {cmd:values} {cmd:count} {cmd:percent} {cmdab:showleg:end} {cmd:ocolor}({it:str}) {cmd:osize}({it:str}) {cmd:ndocolor}({it:str}) {cmd:ndfcolor}({it:str})
+ {cmd:values} {cmd:count} {cmd:percent} {cmdab:showleg:end} {cmd:ocolor}({it:str}) {cmd:osize}({it:str}) {cmd:ndocolor}({it:str}) {cmd:ndfcolor}({it:str}) {cmdab:xdisc:rete} {cmdab:ydisc:rete}
{cmd:textx}({it:str}) {cmd:texty}({it:str}) {cmdab:textg:ap}({it:num}) {cmdab:textlabs:ize}({it:num}) {cmdab:texts:ize}({it:num}) {cmd:formatx}({it:str}) {cmd:formaty}({it:str}) {cmd:xscale}({it:num}) {cmd:yscale}({it:num})
{cmd:polygon}({it:options}) {cmd:line}({it:options}) {cmd:point}({it:options}) {cmd:label}({it:options}) {cmd:arrow}({it:options}) {cmd:diagram}({it:options}) {cmd:scalebar}({it:options})
{cmd:title}({it:str}) {cmd:subtitle}({it:str}) {cmd:note}({it:str}) {cmd:name}({it:str}) {cmd:scheme}({it:str}) {cmd:]}
@@ -41,12 +41,17 @@ The options are described as follows:
{p2coldent : {opt cutx(numlist)}, {opt cuty(numlist)}}For these options, define the {it:middle} cut-off points for the x and y variables. Either one of the two, or both can be specified, and
they will overwrite the {opt cut()} options. The minimum and maximum cut-offs will be estimated directly by the program, therefore do not specify the end points.{p_end}
+{p2coldent : {opt xdisc:rete}, {opt ydisc:rete}} can be used if the variables are assumed categorical, for example, binary variables, or ordinally ranked variables.
+These options overwrite other binning options and legend axes markers will use value labels and will be centered to bin width/height. More than 10 categories will throw an error.
+Hence the maximum combination of discrete variables allowed is 10x10 or 100 bins. This is also to prevent accidentally declaring a regular variable as discrete.{p_end}
+
{p2coldent : {opt palette(option)}}In version v1.6 and above, palettes are dynamically generated for any number of {opt bins()}. Named palettes are:
-{it:pinkgreen}, {it:bluered}, {it:greenblue}, {it:purpleyellow}, {it:yellowblue}, {it:orangeblue}. The old legacy palettes are still available and will default to the
-3x3 scheme. Legacy palettes are: {it:pinkgreen}, {it:bluered0}, {it:greenblue0}, {it:purpleyellow0}, {it:yellowblue0}, {it:orangeblue0}, {it:brew1}, {it:brew2}, {it:brew3}, {it:census}, {it:rgb}, {it:viridis}, {it:gscale}.
-If legacy palettes are defined, then number of bins are fixed at 3x3 and other custom binning options will be ignored.
+{it:pinkgreen}, {it:bluered}, {it:greenblue}, {it:purpleyellow}, {it:yellowblue}, {it:orangeblue}. The original (legacy) palettes are still available with the following names:
+ {it:pinkgreen0}, {it:bluered0}, {it:greenblue0}, {it:purpleyellow0}, {it:yellowblue0}, {it:orangeblue0}, {it:brew1}, {it:brew2}, {it:brew3},
+{it:census}, {it:rgb}, {it:viridis}, {it:gscale}.
+If legacy palettes are defined, the number of bins will default to 3x3 and any other custom binning options will be ignored.
See {browse "https://github.com/asjadnaqvi/stata-bimap":GitHub} for examples of legacy palettes. Default option is {opt palette(pinkgreen)}.
-Users can also over-write the palettes using the {opt clr} options described below.{p_end}
+Users can also over-write the palettes using the {opt clr.()} options described below.{p_end}
{p2coldent : {opt clr0()}, {opt clrx()}, {opt clry()}}Users can overwrite the colors end-points using one or more of these options. Option {opt clr0()} is the
starting bottom-left color. Similarly, {opt clrx()}, {opt clry()} are x-axis bottom-right and y-axis top-left colors. One can either define a "named" Stata color (e.g.
@@ -163,8 +168,8 @@ Please see additional examples on {browse "https://github.com/asjadnaqvi/stata-b
{title:Package details}
-Version : {bf:bimap} v1.62
-This release : 19 May 2023
+Version : {bf:bimap} v1.7
+This release : 15 Jun 2023
First release: 08 Apr 2022
Repository : {browse "https://github.com/asjadnaqvi/stata-bimap":GitHub}
Keywords : Stata, map, bimap, bi-variate
@@ -179,6 +184,7 @@ Twitter : {browse "https://twitter.com/AsjadNaqvi":@AsjadNaqvi}
{title:Acknowledgements}
{p 4 4 2}
+Several requests for allowing categorical variables (v1.7)
Kit Baum, Fayssal Ayad, and Paul reported bug in the bimap v1.6 legends (v1.62, v1.61).
Tyson King-Meadows and Vishakha Agarwal requested a greyscale palette (v1.5).
Souradet Shaw requested scalebar and arrow passthrus (v1.5).
diff --git a/installation/stata.toc b/installation/stata.toc
index 8e34bb6..8ed84c4 100644
--- a/installation/stata.toc
+++ b/installation/stata.toc
@@ -1,7 +1,7 @@
-v 1.62
-d BIMAP: A package for creating bivariate maps.
+v 1.7
+d BIMAP: A package for creating bi-variate maps.
d
-d Distribution-Date: 20230519
+d Distribution-Date: 20230615
d
d Asjad Naqvi
d asjadnaqvi@gmail.com