Skip to content

Commit

Permalink
Remove add.alpha()
Browse files Browse the repository at this point in the history
git-svn-id: svn://scm.r-forge.r-project.org/svnroot/chnosz/pkg/CHNOSZ@830 edb9625f-4e0d-4859-8d74-9fd3b1da38cb
  • Loading branch information
jedick committed Mar 2, 2024
1 parent 6702bef commit 9697071
Show file tree
Hide file tree
Showing 8 changed files with 17 additions and 21 deletions.
4 changes: 2 additions & 2 deletions DESCRIPTION
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
Date: 2024-02-28
Date: 2024-03-02
Package: CHNOSZ
Version: 2.1.0-2
Version: 2.1.0-3
Title: Thermodynamic Calculations and Diagrams for Geochemistry
Authors@R: c(
person("Jeffrey", "Dick", , "[email protected]", role = c("aut", "cre"),
Expand Down
4 changes: 2 additions & 2 deletions NAMESPACE
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ export(
# added 20220416
"rank.affinity",
# added 20220620
"stack_mosaic", "add.alpha"
"stack_mosaic"
)

# Load shared objects
Expand All @@ -70,7 +70,7 @@ useDynLib(CHNOSZ, .registration = TRUE, .fixes = "C_")
# Imports from default packages
importFrom("grDevices", "dev.cur", "dev.off", "extendrange",
"heat.colors", "png", "rainbow", "topo.colors", "dev.list",
"contourLines", "col2rgb", "rgb")
"contourLines", "col2rgb", "rgb", "adjustcolor")
importFrom("graphics", "abline", "axTicks", "axis", "barplot", "box",
"contour", "image", "legend", "lines", "mtext", "par", "plot",
"plot.new", "plot.window", "points", "rect", "text", "title")
Expand Down
2 changes: 1 addition & 1 deletion R/stack_mosaic.R
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ stack_mosaic <- function(bases, species1, species2, species12, names = NULL, col
loga_aq = NULL, plot.it = TRUE, ...) {

# Default is to use semi-transparent fill for bimetallic species
if(is.null(fill)) fill <- list(NA, NA, add.alpha(col.names[3], "50"))
if(is.null(fill)) fill <- list(NA, NA, adjustcolor(col.names[3], alpha.f = 0.312))

# Load species1 (first metal-bearing species)
isp1 <- species(species1)
Expand Down
8 changes: 0 additions & 8 deletions R/util.plot.R
Original file line number Diff line number Diff line change
Expand Up @@ -296,11 +296,3 @@ thermo.axis <- function(lab = NULL, side = 1:4,line = 1.5, cex = par('cex'), lwd
if(!is.null(lab)) mtext(lab, side = thisside, line = line, cex = cex, las = las)
}
}

# Function to add transparency to given color 20220223
add.alpha <- function(col, alpha) {
x <- col2rgb(col)
newcol <- rgb(x[1], x[2], x[3], maxColorValue = 255)
newcol <- paste0(newcol, alpha)
newcol
}
4 changes: 4 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,7 @@
[![DOI](https://zenodo.org/badge/DOI/10.5281/zenodo.7765500.svg)](https://doi.org/10.5281/zenodo.7765500)
[![R-CMD-check](https://github.com/jedick/CHNOSZ/actions/workflows/R-CMD-check.yaml/badge.svg)](https://github.com/jedick/CHNOSZ/actions/workflows/R-CMD-check.yaml)
<!-- badges: end -->

This is a mirror of the [primary repository on R-Forge](https://r-forge.r-project.org/projects/chnosz/).

Please see the [CHNOSZ website](https://chnosz.net) for more information.
8 changes: 7 additions & 1 deletion inst/NEWS.Rd
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,17 @@
\newcommand{\Cp}{\ifelse{latex}{\eqn{C_P}}{\ifelse{html}{\out{<I>C<sub>P</sub></I>}}{Cp}}}
\newcommand{\DG0}{\ifelse{latex}{\eqn{{\Delta}G^{\circ}}}{\ifelse{html}{\out{&Delta;<I>G</I>&deg;}}{ΔG°}}}

\section{Changes in CHNOSZ version 2.1.0-2 (2024-02-28)}{
\section{Changes in CHNOSZ version 2.1.0-3 (2024-03-02)}{

\itemize{

\item Move \code{read.fasta()}, \code{count.aa()}, and \code{aasum()} to canprot package.

\item Remove \code{seq2aa()}.

\item Remove \code{add.alpha()}. Now \code{grDevices::adjustcolor()} is
used in \code{stack_mosaic()} to add transparency.

}

}
Expand Down
3 changes: 1 addition & 2 deletions man/stack_mosaic.Rd
Original file line number Diff line number Diff line change
Expand Up @@ -47,8 +47,7 @@ Here, only a single value of \code{loga_aq} is needed, unlike in \code{\link{mos
The plot parameters \code{col}, \code{col.names}, \code{fill}, \code{dx}, \code{dy}, \code{srt}, \code{lwd}, and \code{lty} should be length-3 lists (not vectors).
The values of elements 1--3 of the list are recycled to the number of species in \code{species1}, \code{species2}, and \code{species12}, respectively.

For \code{fill}, the default is to use no fill except for \code{species12}, where the fill color is taken from \code{col.names} with added transparency.
The default definition of \code{fill} is \code{list(NA, NA, add.alpha(col.names[3], "50"))}.
For \code{fill}, the default is to use no fill except for \code{species12}, where the fill color is taken from \code{col.names} with added transparency added using \code{\link{adjustcolor}}.
}

\section{Warning}{
Expand Down
5 changes: 0 additions & 5 deletions man/util.plot.Rd
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@
\alias{water.lines}
\alias{mtitle}
\alias{ZC.col}
\alias{add.alpha}
\title{Functions to Create and Modify Plots}

\description{
Expand All @@ -34,7 +33,6 @@
lty = 2, lwd = 1, col = par("fg"), plot.it = TRUE)
mtitle(main, line = 0, spacing = 1, ...)
ZC.col(z)
add.alpha(col, alpha)
}

\arguments{
Expand Down Expand Up @@ -72,7 +70,6 @@
\item{main}{character, text for plot title}
\item{spacing}{numeric, spacing between multiple lines}
\item{z}{numeric, set of values}
\item{alpha}{character, hexadecimal value of color transparency (alpha)}
}

\details{
Expand Down Expand Up @@ -107,8 +104,6 @@ This function exists to facilitate using \code{\link{expression}}s in multiline
\code{ZC.col} uses \CRANpkg{colorspace}) to generate colors from a diverging palette (red - light grey - blue) corresponding to the values in \code{z}.
Red is associated with lower values of \code{z}.
This function is intended to generate colors for distinguishing average oxidation state of carbon \code{\link{ZC}}, but any numeric values can be supplied.

\code{add.alpha} adds transparency to a color by appending the value of \code{alpha} to the hexadecimal representation of the color given in \code{col}.
}

\seealso{
Expand Down

0 comments on commit 9697071

Please sign in to comment.