## coordinates of single sector
# type of percent, start = 0, r_start = 0
tmp_df <- sector_df(x = 0.5, y = 0.5, theta = 25, r = 0.4, start = 0, r_start = 0)
tmp_df
grid.newpage()
grid.polygon(
tmp_df$x, tmp_df$y,
vp = viewport(height = unit(1, "snpc"), width = unit(1, "snpc"))
)
# type of percent, start = 50, r_start = 0.2
tmp_df <- sector_df(x = 0.5, y = 0.5, theta = 25, r = 0.4, start = 50, r_start = 0.2)
tmp_df
grid.newpage()
grid.polygon(
tmp_df$x, tmp_df$y,
vp = viewport(height = unit(1, "snpc"), width = unit(1, "snpc"))
)
# type of degree, start = 90, r_start = 0
tmp_df <- sector_df(
x = 0.5, y = 0.5, theta = 180, r = 0.4,
start = 90, r_start = 0, type = "degree"
)
tmp_df
grid.newpage()
grid.polygon(
tmp_df$x, tmp_df$y,
vp = viewport(height = unit(1, "snpc"), width = unit(1, "snpc"))
)
# type of degree, start = 180, r_start = 0.2
tmp_df <- sector_df(
x = 0.5, y = 0.5, theta = 180, r = 0.4,
start = 270, r_start = 0.2, type = "degree"
)
tmp_df
grid.newpage()
grid.polygon(
tmp_df$x, tmp_df$y,
vp = viewport(height = unit(1, "snpc"), width = unit(1, "snpc"))
)
## Coordinates of Multiple Sectors
tmp_df <- sector_df_multiple(
x = c(0.2, 0.5, 0.8),
theta = c(25, 50, 75),
r = 0.15,
start = c(75, 50, 100),
r_start = c(0, 0.05, 0.1),
type = "percent"
)
tmp_df
grid.newpage()
grid.polygon(
tmp_df$x,
tmp_df$y,
id = tmp_df$group,
vp = viewport(height = unit(1, "snpc"), width = unit(1, "snpc")),
gp = gpar(
fill = 3:1, col = 1:3
)
)
# type = 10, 100, 1000
tmp_df <- sector_df_multiple(
x = c(0.25, 0.5, 0.75),
theta = c(7.5, 75, 750),
r = 0.125,
r_start = c(0.05),
type = c(c(10, "percent", 1000))
)
tmp_df
grid.newpage()
grid.polygon(
tmp_df$x,
tmp_df$y,
id = tmp_df$group,
vp = viewport(height = unit(1, "snpc"), width = unit(1, "snpc")),
gp = gpar(
fill = 3:1, col = 1:3
)
)
Run the code above in your browser using DataLab