Skip to content

Commit

Permalink
add argument to adjust line width
Browse files Browse the repository at this point in the history
  • Loading branch information
lvclark committed May 26, 2016
1 parent 19e1cd6 commit 6f88640
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions squarePie.R
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ require(plotrix)
# x and y are the center coordinates for the square.
# slicesizes is a vector of the relative sizes of the slices; does not have to sum to 1,
# and can contain zeros.
squarePie <- function(x, y, slicesizes, width, col = rainbow(length(slicesizes))){
squarePie <- function(x, y, slicesizes, width, col = rainbow(length(slicesizes)), lwd = 1){
if(length(x) != 1 || length(y) != 1){
stop("squarePie only creates one pie chart at a time. Use a for loop or mapply to make multiple pie charts.")
}
Expand Down Expand Up @@ -123,12 +123,12 @@ squarePie <- function(x, y, slicesizes, width, col = rainbow(length(slicesizes))

# draw the polygon
polygon(x = sliceVertices[[s]]$x, y = sliceVertices[[s]]$y,
col = col[s])
col = col[s], lwd = lwd)
}
return(invisible(list(sliceVertices, col)))
}

trianglePie <- function(x, y, slicesizes, width, col = rainbow(length(slicesizes))){
trianglePie <- function(x, y, slicesizes, width, col = rainbow(length(slicesizes)), lwd = 1){
if(length(x) != 1 || length(y) != 1){
stop("trianglePie only creates one pie chart at a time. Use a for loop or mapply to make multiple pie charts.")
}
Expand Down Expand Up @@ -239,7 +239,7 @@ trianglePie <- function(x, y, slicesizes, width, col = rainbow(length(slicesizes

# draw the polygon
polygon(x = sliceVertices[[s]]$x, y = sliceVertices[[s]]$y,
col = col[s])
col = col[s], lwd = lwd)
}
return(invisible(list(sliceVertices, col)))
}

0 comments on commit 6f88640

Please sign in to comment.