Created
January 31, 2012 04:23
-
-
Save kohske/1708789 to your computer and use it in GitHub Desktop.
fujipie
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#' fujipie | |
#' | |
#' 例のフジテレビのパイチャート関数 | |
#' | |
#' @param d numeric vector データベクトル | |
#' @param x,y numeric 歪み | |
#' @param r numeric (> 0) 良心(大きいほど良心的) | |
#' @param a numeric [0-1]. 良心(小さいほど良心的) | |
fujipie <- function(d, x, y, r, a) { | |
par(mar=c(0,0,0,0)) | |
pie(d) | |
t=seq(0,2*pi,l=360) | |
polygon(c(cos(t)*r,cos(rev(t))*3)+x,c(sin(t)*r,sin(rev(t))*3)+y,col=rgb(1,1,1,a),lty=0) | |
polygon(cos(t)*r+x,sin(t)*r+y,lty=1) | |
} | |
fujipie(c(1,1,0.9,1.1), 0.05, -0.15, 0.5, 0.9) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment