Skip to content

Commit

Permalink
Further options in plot.colourmap
Browse files Browse the repository at this point in the history
  • Loading branch information
baddstats committed May 2, 2024
1 parent b814617 commit 864f153
Show file tree
Hide file tree
Showing 6 changed files with 26 additions and 7 deletions.
2 changes: 1 addition & 1 deletion DESCRIPTION
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
Package: spatstat.geom
Version: 3.2-9.016
Version: 3.2-9.017
Date: 2024-05-02
Title: Geometrical Functionality of the 'spatstat' Family
Authors@R: c(person("Adrian", "Baddeley",
Expand Down
5 changes: 4 additions & 1 deletion NEWS
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
CHANGES IN spatstat.geom VERSION 3.2-9.016
CHANGES IN spatstat.geom VERSION 3.2-9.017

OVERVIEW

Expand Down Expand Up @@ -32,6 +32,9 @@ SIGNIFICANT USER-VISIBLE CHANGES
New argument 'nticks' controls the number of axis tick marks
when the colourmap is defined on a continuous range of numerical values.

o plot.colourmap
New argument 'box' controls whether a box will be drawn around the colours.

o plot.tess
Changed the default values for do.col and do.labels

Expand Down
10 changes: 8 additions & 2 deletions R/colourtables.R
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
#
# support for colour maps and other lookup tables
#
# $Revision: 1.51 $ $Date: 2024/05/02 03:50:40 $
# $Revision: 1.52 $ $Date: 2024/05/02 06:19:31 $
#

colourmap <- function(col, ..., range=NULL, breaks=NULL, inputs=NULL, gamma=1) {
Expand Down Expand Up @@ -247,7 +247,7 @@ plot.colourmap <- local({
plot.colourmap <- function(x, ..., main,
xlim=NULL, ylim=NULL, vertical=FALSE, axis=TRUE,
labelmap=NULL, gap=0.25, add=FALSE,
increasing=NULL, nticks=5) {
increasing=NULL, nticks=5, box=NULL) {
if(missing(main))
main <- short.deparse(substitute(x))
stuff <- attr(x, "stuff")
Expand Down Expand Up @@ -403,6 +403,12 @@ plot.colourmap <- local({
col=col)),
extrargs=imageparams)
}
#' draw box around colours?
#' default is TRUE unless drawing blocks of colour with gaps between.
if(is.null(box)) box <- !separate
if(!isFALSE(box))
rect(xlim[1], ylim[1], xlim[2], ylim[2])

if(axis) {
# ................. draw annotation ..................
if(!vertical) {
Expand Down
2 changes: 1 addition & 1 deletion inst/doc/packagesizes.txt
Original file line number Diff line number Diff line change
Expand Up @@ -26,4 +26,4 @@ date version nhelpfiles nobjects ndatasets Rlines srclines
"2023-10-20" "3.2-7" 451 1203 0 35983 15822
"2024-01-26" "3.2-8" 452 1204 0 36234 15822
"2024-02-28" "3.2-9" 452 1209 0 36325 15824
"2024-05-02" "3.2-9.016" 443 1188 0 35712 15596
"2024-05-02" "3.2-9.017" 443 1188 0 35718 15596
8 changes: 7 additions & 1 deletion man/plot.colourmap.Rd
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
\usage{
\method{plot}{colourmap}(x, ...,
main, xlim = NULL, ylim = NULL, vertical = FALSE, axis = TRUE,
labelmap=NULL, gap=0.25, add=FALSE, increasing=NULL, nticks=5)
labelmap=NULL, gap=0.25, add=FALSE, increasing=NULL, nticks=5, box=NULL)
}
\arguments{
\item{x}{Colour map to be plotted. An object of class \code{"colourmap"}.}
Expand Down Expand Up @@ -56,6 +56,12 @@
drawn next to the colour map. Applies only when the colour map
inputs are numeric values.
}
\item{box}{
Optional. Logical value specifying whether to draw a black box
around the colour ribbon. Default is \code{box=FALSE} when plotting
separate blocks of colour (i.e. when the colourmap is discrete
and \code{gap > 0}) and \code{box=TRUE} otherwise.
}
}
\details{
This is the plot method for the class \code{"colourmap"}.
Expand Down
6 changes: 5 additions & 1 deletion man/plot.ppp.Rd
Original file line number Diff line number Diff line change
Expand Up @@ -445,12 +445,16 @@
colmap <- colourmap(terrain.colors(20), range=ra)
## filled plot characters are the codes 21-25
## fill colour is indicated by 'bg'
sy <- symbolmap(pch=21, bg=colmap, range=ra)
## outline colour is 'fg'
sy <- symbolmap(pch=21, bg=colmap, fg=colmap, range=ra)
plot(longleaf, symap=sy)

## or more compactly..
plot(longleaf, bg=terrain.colors(20), pch=21, cex=1)

## plot only the colour map (since the symbols have fixed size and shape)
plot(longleaf, symap=sy, leg.args=list(colour.only=TRUE))

## clipping
plot(humberside)
B <- owin(c(4810, 5190), c(4180, 4430))
Expand Down

0 comments on commit 864f153

Please sign in to comment.