Skip to content

Commit

Permalink
Ready for CRAN
Browse files Browse the repository at this point in the history
  • Loading branch information
baddstats committed Nov 18, 2024
1 parent f3cf22c commit 0ac5f88
Show file tree
Hide file tree
Showing 8 changed files with 106 additions and 17 deletions.
10 changes: 5 additions & 5 deletions DESCRIPTION
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
Package: spatstat.geom
Version: 3.3-3.005
Date: 2024-10-28
Version: 3.3-4
Date: 2024-11-18
Title: Geometrical Functionality of the 'spatstat' Family
Authors@R: c(person("Adrian", "Baddeley",
role = c("aut", "cre", "cph"),
Expand All @@ -24,9 +24,9 @@ Authors@R: c(person("Adrian", "Baddeley",
person("Dominic", "Schuhmacher", role = "ctb"),
person("Rasmus", "Waagepetersen", role = "ctb"))
Maintainer: Adrian Baddeley <[email protected]>
Depends: R (>= 3.5.0), spatstat.data (>= 3.1), spatstat.univar (>= 3.0-0), stats, graphics, grDevices, utils, methods
Imports: spatstat.utils (>= 3.1-0.001), deldir (>= 1.0-2), polyclip (>= 1.10-0)
Suggests: spatstat.random, spatstat.explore, spatstat.model, spatstat.linnet, spatial, fftwtools (>= 0.9-8), spatstat (>= 3.0)
Depends: R (>= 3.5.0), spatstat.data (>= 3.1), spatstat.univar (>= 3.1-0), stats, graphics, grDevices, utils, methods
Imports: spatstat.utils (>= 3.1-1), deldir (>= 1.0-2), polyclip (>= 1.10-0)
Suggests: spatstat.random (>= 3.3), spatstat.explore (>= 3.3), spatstat.model (>= 3.3), spatstat.linnet (>= 3.2), spatial, fftwtools (>= 0.9-8), spatstat (>= 3.2)
Description: Defines spatial data types and supports geometrical operations
on them. Data types include point patterns, windows (domains),
pixel images, line segment patterns, tessellations and hyperframes.
Expand Down
2 changes: 2 additions & 0 deletions NAMESPACE
Original file line number Diff line number Diff line change
Expand Up @@ -285,6 +285,7 @@ export("crosspairs.ppp")
export("cut.im")
export("cut.ppp")
export("default.dummy")
export("default.image.colours")
export("default.ntile")
export("default.n.tiling")
export("default.symbolmap")
Expand Down Expand Up @@ -887,6 +888,7 @@ export("rescale.ppp")
export("rescale.psp")
export("rescale.unitname")
export("rescue.rectangle")
export("reset.default.image.colours")
export("reset.spatstat.options")
export("resolve.stringsAsFactors")
export("restrict.colourmap")
Expand Down
7 changes: 6 additions & 1 deletion NEWS
Original file line number Diff line number Diff line change
@@ -1,13 +1,18 @@
CHANGES IN spatstat.geom VERSION 3.3-3.005
CHANGES IN spatstat.geom VERSION 3.3-4

OVERVIEW

o Tessellations can have any kind of marks.

o More control over default colours.

o Minor improvements.

SIGNIFICANT USER-VISIBLE CHANGES

o default.image.colours, reset.default.image.colours
Control the default colours used for plotting images in spatstat.

o tess, marks<-.tess
A tessellation can now have any kind of marks
(vector, list, data frame or hyperframe).
Expand Down
36 changes: 28 additions & 8 deletions R/options.R
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
#
# Spatstat options and other internal states
#
# $Revision: 1.94 $ $Date: 2024/01/08 06:37:19 $
# $Revision: 1.96 $ $Date: 2024/11/18 02:44:24 $
#
#

Expand All @@ -13,8 +13,8 @@ putSpatstatVariable("Spatstat.ProgressData", NULL)
putSpatstatVariable("warnedkeys", character(0))

## Kovesi's uniform colour map, row 29, linear 'bmy'
putSpatstatVariable("DefaultImageColours",
c("#000C7D", "#000D7E", "#000D80", "#000E81", "#000E83", "#000E85",
.Kovesi29 <- c(
"#000C7D", "#000D7E", "#000D80", "#000E81", "#000E83", "#000E85",
"#000F86", "#000F88", "#00108A", "#00108B", "#00118D", "#00118F",
"#001190", "#001292", "#001293", "#001295", "#001396", "#001398",
"#001399", "#00149A", "#00149C", "#00149D", "#00149E", "#00159F",
Expand Down Expand Up @@ -56,7 +56,30 @@ c("#000C7D", "#000D7E", "#000D80", "#000E81", "#000E83", "#000E85",
"#FED51C", "#FED61D", "#FED71D", "#FED91D", "#FEDA1D", "#FEDB1D",
"#FEDD1D", "#FEDE1E", "#FEDF1E", "#FEE11E", "#FEE21E", "#FEE31F",
"#FEE51F", "#FEE61F", "#FEE720", "#FEE820", "#FEEA21", "#FEEB21",
"#FEEC22", "#FEEE22", "#FEEF23", "#FEF023"))
"#FEEC22", "#FEEE22", "#FEEF23", "#FEF023")

putSpatstatVariable("DefaultImageColours", .Kovesi29)

.Spatstat.Default.Image.Colfun <- function(n) {
z <- getSpatstatVariable("DefaultImageColours")
interp.colours(z, n)
}

default.image.colours <- function() {
getSpatstatVariable("DefaultImageColours")
}

reset.default.image.colours <- function(col=NULL) {
if(is.null(col)) {
col <- .Kovesi29
} else if(!is.colour(col)) {
stop("col should be a vector of colour values")
}
putSpatstatVariable("DefaultImageColours", col)
spatstat.options(image.colfun = .Spatstat.Default.Image.Colfun)
return(invisible(col))
}


warn.once <- function(key, ...) {
warned <- getSpatstatVariable("warnedkeys")
Expand Down Expand Up @@ -214,10 +237,7 @@ warn.once <- function(key, ...) {
image.colfun=list(
## default colour scheme for plot.im
# default=function(n){topo.colors(n)},
default=function(n) {
z <- getSpatstatVariable("DefaultImageColours")
interp.colours(z, n)
},
default=.Spatstat.Default.Image.Colfun,
check=function(x) {
if(!is.function(x) || length(formals(x)) == 0) return(FALSE)
y <- x(42)
Expand Down
2 changes: 1 addition & 1 deletion inst/doc/packagesizes.txt
Original file line number Diff line number Diff line change
Expand Up @@ -29,4 +29,4 @@ date version nhelpfiles nobjects ndatasets Rlines srclines
"2024-07-05" "3.3-0" 442 1186 0 35638 15596
"2024-07-09" "3.3-2" 442 1186 0 35638 15596
"2024-09-18" "3.3-3" 443 1187 0 35818 15596
"2024-10-28" "3.3-3.005" 443 1188 0 35958 15596
"2024-11-18" "3.3-4" 444 1190 0 35978 15596
2 changes: 1 addition & 1 deletion inst/info/packagesizes.txt
Original file line number Diff line number Diff line change
Expand Up @@ -29,4 +29,4 @@ date version nhelpfiles nobjects ndatasets Rlines srclines
"2024-07-05" "3.3-0" 442 1186 0 35638 15596
"2024-07-09" "3.3-2" 442 1186 0 35638 15596
"2024-09-18" "3.3-3" 443 1187 0 35818 15596
"2024-10-28" "3.3-3.005" 443 1188 0 35958 15596
"2024-11-18" "3.3-4" 444 1190 0 35978 15596
57 changes: 57 additions & 0 deletions man/default.image.colours.Rd
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
\name{default.image.colours}
\alias{default.image.colours}
\alias{reset.default.image.colours}
\title{
Default Colours for Images in Spatstat
}
\description{
Extract or change the default colours for images in \pkg{spatstat}.
}
\usage{
default.image.colours()
reset.default.image.colours(col = NULL)
}
\arguments{
\item{col}{
A vector of colour values.
}
}
\details{
These functions extract and change the current default colours
used for plotting colour images in the \pkg{spatstat} family of
packages, in particular by the functions
\code{\link[spatstat.geom]{plot.im}}
and \code{\link[spatstat.linnet]{plot.linim}}.

The default colour values are a vector of
character strings which can be interpreted as colours.
In any particular instance of
\code{\link[spatstat.geom]{plot.im}}
or \code{\link[spatstat.linnet]{plot.linim}},
the default colours are interpolated to obtain a vector of colour
values of the required length (usually 256, controlled by the
argument \code{ncolours} to the plot command).

\code{default.image.colours()} returns the current default colours.
\code{reset.default.image.colours(col)} sets the default colours to
be the vector \code{col}.
\code{reset.default.image.colours()} or
\code{reset.default.image.colours(NULL)} resets the
factory default, which is row 29 of the Kovesi uniform
perceptual contrast table described in \code{\link[spatstat.data]{Kovesi}}.
}
\value{
A character vector of values which can be interpreted as colours.
}
\author{
\adrian.
}
\seealso{
\code{\link[spatstat.geom]{plot.im}}
}
\examples{
a <- default.image.colours()
length(a)
}
\keyword{color}
\keyword{hplot}
7 changes: 6 additions & 1 deletion man/plot.im.Rd
Original file line number Diff line number Diff line change
Expand Up @@ -298,6 +298,10 @@
}
}
If \code{col} is missing or \code{col=NULL}, the default colour values
are the linear, perceptually uniform colour sequence given by
\code{\link[spatstat.data]{Kovesi}[[29,"values"]]}.
If \code{spatstat.options("monochrome")} has been set to \code{TRUE}
then \bold{all colours will be converted to grey scale values}.
Expand Down Expand Up @@ -427,7 +431,8 @@
\code{\link{persp.im}},
\code{\link{hist.im}},
\code{\link[graphics]{image.default}},
\code{\link{spatstat.options}}
\code{\link{spatstat.options}},
\code{\link{default.image.colours}}
}
\examples{
# an image
Expand Down

0 comments on commit 0ac5f88

Please sign in to comment.