Skip to content

Commit

Permalink
Update bimap.ado
Browse files Browse the repository at this point in the history
  • Loading branch information
asjadnaqvi committed Jun 27, 2023
1 parent eea5388 commit ce91c33
Showing 1 changed file with 11 additions and 41 deletions.
52 changes: 11 additions & 41 deletions installation/bimap.ado
Original file line number Diff line number Diff line change
Expand Up @@ -530,22 +530,13 @@ qui {
**************************
**** Legend *****
**************************




keep `var1' `var2'
ren `var2' ydot
ren `var1' xdot

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'" == "" {
Expand Down Expand Up @@ -583,12 +574,6 @@ qui {
local ycats `ylist'
}


di "`xcats'"
di "`ycats'"



/////

local xlen : word count `xcats'
Expand All @@ -598,9 +583,6 @@ qui {
local ylen = `ylen' - 1





local myobs = `xlen' * `ylen' * 5

if _N < `myobs' {
Expand All @@ -626,7 +608,6 @@ qui {
gen double y_mark = .
gen double y_val = .

di "Check here"

local z = 1

Expand Down Expand Up @@ -655,18 +636,13 @@ qui {
}
}



replace x = x / `xmax'
replace y = y / `ymax'


bysort box: egen double x_mid = mean(x)
bysort box: egen double y_mid = mean(y)

replace x_mid = . if tag!=1
replace y_mid = . if tag!=1

di "Check here 2"

if "`count'" != "" | "`percent'" != "" {
gen mycount = .
Expand Down Expand Up @@ -695,24 +671,16 @@ qui {

// markers

di "Check here 3"

di "`xcats'"
di "`xlist'"



// for x-axis




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_mark = `: word `i0' of `xcats'' in `z'
replace x_val = `: word `i0' of `xlist'' in `z'
local z = `z' + 1
}
Expand All @@ -722,7 +690,7 @@ qui {

local z = 1
forval i0 = 1/`xlen' {
replace x_mark = `: word `i0' of `xcats'' / `xmax' in `z'
replace x_mark = `: word `i0' of `xcats'' in `z'
replace x_val = `: word `i0' of `xdiscli'' in `z'
local z = `z' + 1
}
Expand All @@ -738,7 +706,7 @@ qui {

local z = 1
forval i0 = 1/`ylen' {
replace y_mark = `: word `i0' of `ycats'' / `ymax' in `z'
replace y_mark = `: word `i0' of `ycats'' in `z'
replace y_val = `: word `i0' of `ylist'' in `z'
local z = `z' + 1
}
Expand All @@ -748,7 +716,7 @@ qui {

local z = 1
forval i0 = 1/`ylen' {
replace y_mark = `: word `i0' of `ycats'' / `ymax' in `z'
replace y_mark = `: word `i0' of `ycats'' in `z'
replace y_val = `: word `i0' of `ydiscli'' in `z'
local z = `z' + 1
}
Expand All @@ -757,6 +725,8 @@ qui {





// rescale x and y (0-1)

summ x, meanonly
Expand All @@ -770,6 +740,7 @@ qui {
replace y_mark = (y_mark - r(min)) / (r(max) - r(min))



if "`xdiscrete'"!="" replace x_mark = x_mark + ((1/`xlen')/2)
if "`ydiscrete'"!="" replace y_mark = y_mark + ((1/`ylen')/2)

Expand Down Expand Up @@ -852,11 +823,10 @@ qui {
(scatter laby labx in 1, mcolor(none) mlab(labn) mlabsize(`textsize') mlabpos(0) ) ///
(scatter laby labx in 2, mcolor(none) mlab(labn) mlabsize(`textsize') mlabpos(0) mlabangle(90)) ///
, ///
xlabel(-0.2 1, nogrid) ylabel(-0.15 1, nogrid) ///
xlabel(-0.2 1, nogrid) ylabel(-0.2 1, nogrid) ///
yscale(range(0 1.1) off) xscale(range(0 1.1) off) ///
aspectratio(1) ///
xsize(1) ysize(1) ///
ytitle("variable 1") xtitle("variable2") ///
fxsize(`xscale') fysize(`yscale') ///
legend(off) ///
name(_legend, replace) nodraw
Expand Down

0 comments on commit ce91c33

Please sign in to comment.