Skip to content

Commit

Permalink
Remove dependency on areaplot package
Browse files Browse the repository at this point in the history
  • Loading branch information
arni-magnusson committed Nov 15, 2022
1 parent c060de2 commit 4288301
Show file tree
Hide file tree
Showing 4 changed files with 24 additions and 7 deletions.
6 changes: 3 additions & 3 deletions DESCRIPTION
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
Package: SOFIA
Version: 2.1.0
Date: 2022-11-11
Version: 2.1.1
Date: 2022-11-15
Title: Tools to Work with SOFIA Analyses
Authors@R: c(person("Rishi", "Sharma", role="aut"),
person("Arni", "Magnusson", role=c("aut","cre"), email="thisisarni@gmail.com"))
Imports: graphics, stats, utils, areaplot, ggplot2, sraplus, TAF
Imports: graphics, stats, utils, ggplot2, sraplus, TAF
Description: Tools that support the SOFIA Transparent Assessment Framework.
License: GPL-3
URL: https://github.com/sofia-taf/SOFIA
Expand Down
3 changes: 2 additions & 1 deletion NAMESPACE
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ export(groupData)
export(plotCat)
export(plotProp)
importFrom(TAF,write.taf)
importFrom(areaplot,areaplot)
importFrom(ggplot2,aes)
importFrom(ggplot2,geom_bar)
importFrom(ggplot2,geom_raster)
Expand All @@ -22,7 +21,9 @@ importFrom(ggplot2,scale_fill_manual)
importFrom(ggplot2,theme_minimal)
importFrom(graphics,abline)
importFrom(graphics,box)
importFrom(graphics,matplot)
importFrom(graphics,par)
importFrom(graphics,polygon)
importFrom(graphics,title)
importFrom(sraplus,format_driors)
importFrom(stats,na.omit)
Expand Down
7 changes: 7 additions & 0 deletions NEWS.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,10 @@
# SOFIA 2.1.1 (2022-11-15)

* Removed dependency on areaplot package.




# SOFIA 2.1.0 (2022-11-11)

* Added function addIndex() to add index column to catch data.
Expand Down
15 changes: 12 additions & 3 deletions R/plotCat.R
Original file line number Diff line number Diff line change
Expand Up @@ -52,8 +52,7 @@
#'
#' @importFrom ggplot2 aes geom_bar geom_raster ggplot theme_minimal
#' scale_fill_manual
#' @importFrom areaplot areaplot
#' @importFrom graphics abline box par title
#' @importFrom graphics abline box matplot par polygon title
#'
#' @export

Expand Down Expand Up @@ -96,7 +95,17 @@ plotCat <- function(dat, method="cmsy.naive", cats=4, type="count", legend=TRUE)
if(legend)
opar <- par(fig=c(0,0.8,0,1))
percent <- 100 * prop.table(table(status$year, status$estCat), margin=1)
areaplot(percent, col=col, ann=FALSE, xaxs="i", yaxs="i", border=NA)
## beg: areaplot(percent, col=col, ann=FALSE, xaxs="i", yaxs="i", border=NA)
x <- as.integer(rownames(percent))
y <- t(rbind(0, apply(percent, 1, cumsum)))
matplot(x, y, type="n", ann=FALSE, xaxs="i", yaxs="i")
xx <- c(x, rev(x))
for(i in 1:(ncol(y)-1))
{
yy <- c(y[,i+1], rev(y[,i]))
polygon(xx, yy, col=col[i], border=NA)
}
## end: areaplot(percent, col=col, ann=FALSE, xaxs="i", yaxs="i", border=NA)
abline(h=c(20,40,60,80), col="lightgray", lty=2)
title(xlab="Year", ylab="Stock status (%)")
box()
Expand Down

0 comments on commit 4288301

Please sign in to comment.