📄 yxview_sunflower_draw.ado
字号:
*! version 1.0.5 03oct2003
// Drawing program for the sunflower yxview.
program yxview_sunflower_draw
// rotation/rescale to get hexagons to point vertically
local angle = c(pi)/2
// note: sunflower hexagons are a 90 degree rotation of those drawn by
// -gdi_hexagon-, thus we must divide by sqrt(3)/2
// half length between opposite sides
local r = `.binwidth'/sqrt(3) // the 2's cancel
// note: do not divide by sqrt(3)/2 for the bin height; gdi_hexagon
// handles this automatically
// half length between opposite points
local h = `r'*`.binar'
// flower petal radius and height
local fr = (`.binwidth'/2)*(`.pl'/100)
local fh = (`.binwidth'/2)*(`.pl'/100)*`.binar'
// Draw the points and the light and dark hexagonal bins
forvalues j = 1/`:serset N' {
local y = serset(`.yvar', `j')
local c = serset(`.cvar', `j')
local x = serset(`.xvar', `j')
// the following shouldn't be possible
if missing(`x'+`y'+`c') continue
if `c' < `.light' {
.style.marker.setgdifull
// singular points
gdi point `x' `y'
}
else if `c' < `.dark' {
// draw hexagon
.style.lighthexbin.setgdifull
gdi_hexagon `x' `y' `r' `h' `angle'
if `c' > 1 | `.singlepetal' {
// draw the flower
.style.lightflower.setgdifull
gdi_spokes `x' `y' `fr' `fh' `c'
}
else {
// singular point in a bin
.style.marker.setgdifull
gdi point `x' `y'
}
}
else {
// draw hexagon
.style.darkhexbin.setgdifull
gdi_hexagon `x' `y' `r' `h' `angle'
local petals = max(1,round(`c'/`.pw',1))
if `petals' > 1 | `.singlepetal' {
// draw the flower
.style.darkflower.setgdifull
gdi_spokes `x' `y' `fr' `fh' `petals'
}
else {
// singular point in a bin
.style.marker.setgdifull
gdi point `x' `y'
}
}
}
end
exit
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -