Skip to content

Commit

Permalink
persp methods recognise adj.main
Browse files Browse the repository at this point in the history
  • Loading branch information
baddstats committed Dec 2, 2024
1 parent 62f9829 commit 8827d84
Show file tree
Hide file tree
Showing 8 changed files with 70 additions and 33 deletions.
4 changes: 2 additions & 2 deletions DESCRIPTION
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
Package: spatstat.geom
Version: 3.3-4.006
Version: 3.3-4.007
Date: 2024-12-02
Title: Geometrical Functionality of the 'spatstat' Family
Authors@R: c(person("Adrian", "Baddeley",
Expand All @@ -25,7 +25,7 @@ Authors@R: c(person("Adrian", "Baddeley",
person("Rasmus", "Waagepetersen", role = "ctb"))
Maintainer: Adrian Baddeley <[email protected]>
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)
Imports: spatstat.utils (>= 3.1-1.001), 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),
Expand Down
8 changes: 7 additions & 1 deletion NEWS
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
CHANGES IN spatstat.geom VERSION 3.3-4.006
CHANGES IN spatstat.geom VERSION 3.3-4.007

OVERVIEW

Expand Down Expand Up @@ -49,6 +49,12 @@ SIGNIFICANT USER-VISIBLE CHANGES
o plot.texturemap
New formal argument 'side'.

o persp.im
Now recognises argument 'adj.main' controlling the position of main title.

o persp.ppp
Now recognises argument 'adj.main' controlling the position of main title.

BUG FIXES

o rotate.im
Expand Down
4 changes: 4 additions & 0 deletions R/persp.im.R
Original file line number Diff line number Diff line change
Expand Up @@ -123,6 +123,10 @@ persp.im <- function(x, ...,
dotargs <- list(...)
if(spatstat.options("monochrome"))
dotargs <- col.args.to.grey(dotargs)

## catch argument 'adj.main' and convert to recognised argument 'adj'
if(!is.na(k <- match("adj.main", names(dotargs))))
names(dotargs)[k] <- "adj"

xcol <- x$xcol
yrow <- x$yrow
Expand Down
26 changes: 17 additions & 9 deletions R/persp.ppp.R
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
#' Copyright (C) Adrian Baddeley 2024
#' GPL Public Licence >= 2.0
#'
#' $Revision: 1.5 $ $Date: 2024/10/28 06:10:01 $
#' $Revision: 1.6 $ $Date: 2024/12/02 04:33:39 $

persp.ppp <- local({

Expand Down Expand Up @@ -55,6 +55,7 @@ persp.ppp <- local({
)
marx <- as.numeric(marx)
if(is.null(zlim)) zlim <- range(marx, 0)
check.range(zlim)
#' rescale marks to a scale commensurate with window
#' (to achieve appropriate default scale in persp.default)
maxmark <- max(abs(marx))
Expand All @@ -66,11 +67,21 @@ persp.ppp <- local({
scaled.marx <- marx
scaled.zlim <- zlim
}
#' set up perspective transformation and plot horizontal plane
#' Set up objects to be plotted in perspective
Rplus <- grow.rectangle(R, fraction=1/(2*ngrid))
#' base plane image
Z <- as.im(0, W=Rplus, dimyx=rev(ngrid)+1)
check.range(zlim)
#' spikes
S <- xyzsegmentdata(x$x, x$y, 0,
x$x, x$y, scaled.marx)
#' bubbles
if(type == "b")
P <- data.frame(x=x$x, y=x$y, z=scaled.marx)

#' Assemble arguments for persp.default
col.grid.used <- if(grid && (zlim[1] >= 0)) col.grid else NA
if(!is.na(k <- match("adj.main", names(dotargs))))
names(dotargs)[k] <- "adj"
argh <- resolve.defaults(list(x=Z, main=main,
border=col.grid.used,
col=col.base),
Expand All @@ -81,15 +92,12 @@ persp.ppp <- local({
scale=FALSE,
#' expand=0.1 is default in persp.default
expand=zadjust * 0.1))

#' Start perspective plot; plot horizontal plane
M <- do.call.matched(persp.im, argh,
funargs=graphicsPars("persp"))
#' create spikes
S <- xyzsegmentdata(x$x, x$y, 0,
x$x, x$y, scaled.marx)
#' and bubbles
if(type == "b")
P <- data.frame(x=x$x, y=x$y, z=scaled.marx)

#' Start drawing objects
if(grid) {
if(scaled.zlim[1] < 0) {
#' first draw downward spikes
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-12-02" "3.3-4.006" 445 1191 0 36134 15596
"2024-12-02" "3.3-4.007" 445 1191 0 36146 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-12-02" "3.3-4.006" 445 1191 0 36134 15596
"2024-12-02" "3.3-4.007" 445 1191 0 36146 15596
15 changes: 13 additions & 2 deletions man/plot.im.Rd
Original file line number Diff line number Diff line change
Expand Up @@ -364,10 +364,21 @@
If pixel values are interpreted as colours,
the arguments \code{col} and \code{ribbon} will be ignored,
and a ribbon will not be plotted.
}
\section{Adding contour lines}{
If \code{addcontour=TRUE}, contour lines will be superimposed on the
image. Lines will also be superimposed on the colour ribbon at the
corresponding positions.
corresponding positions.
The display of the contour lines can be controlled by
arguments specified in \code{contourargs}.
}
\section{Main title, box and white space}{
The left-right placement of the main title is controlled by the
argument \code{adj.main} passed to \code{\link[spatstat.geom]{plot.owin}}.
A rectangular box surrounding the image domain is drawn by default; it can be
suppressed by setting \code{box=FALSE}.
White space around the plot is controlled by
\code{\link[graphics]{par}('mar')}.
}
\section{Complex-valued images}{
If the pixel values in \code{x} are complex numbers,
Expand Down
42 changes: 25 additions & 17 deletions man/plot.ppp.Rd
Original file line number Diff line number Diff line change
Expand Up @@ -317,23 +317,31 @@
It can be used to make a suitable legend,
or to ensure that two plots use the same graphics map.
}
\section{Removing White Space Around The Plot}{
A frequently-asked question is: How do I remove the white space around
the plot? Currently \code{plot.ppp} uses the base graphics system of
\R, so the space around the plot is controlled by parameters
to \code{\link{par}}. To reduce the white space, change the
parameter \code{mar}. Typically, \code{par(mar=rep(0.5, 4))} is
adequate, if there are no annotations or titles outside the window.
}
\section{Drawing coordinate axes and axis labels}{
Coordinate axes and axis labels are not drawn, by default.
To draw coordinate axes, set \code{axes=TRUE}.
To draw axis labels, set \code{ann=TRUE} and give values to the
arguments \code{xlab} and \code{ylab}. See the Examples.
Only the default style of axis is supported;
for more control over the placement and style of axes,
use the graphics commands
\code{\link[graphics]{axis}} and \code{\link[graphics]{mtext}}.
\section{Layout of the plot}{
\itemize{
\item
\bold{Placement of main title:}
The left-right placement of the main title is controlled by the
argument \code{adj.main} passed to \code{\link[spatstat.geom]{plot.owin}}.
To remove the main title, set \code{main=""}.
\item
\bold{Removing White Space Around The Plot:}
A frequently-asked question is: How do I remove the white space around
the plot? Currently \code{plot.ppp} uses the base graphics system of
\R, so the space around the plot is controlled by parameters
to \code{\link{par}}. To reduce the white space, change the
parameter \code{mar}. Typically, \code{par(mar=rep(0.5, 4))} is
adequate, if there are no annotations or titles outside the window.
\item \bold{Drawing coordinate axes and axis labels:}
Coordinate axes and axis labels are not drawn, by default.
To draw coordinate axes, set \code{axes=TRUE}.
To draw axis labels, set \code{ann=TRUE} and give values to the
arguments \code{xlab} and \code{ylab}. See the Examples.
Only the default style of axis is supported;
for more control over the placement and style of axes,
use the graphics commands
\code{\link[graphics]{axis}} and \code{\link[graphics]{mtext}}.
}
}
\section{The Symbol Map}{
The behaviour of \code{plot.ppp} is different from the
Expand Down

0 comments on commit 8827d84

Please sign in to comment.