\documentclass[11pt]{article}

% \VignetteIndexEntry{Datasets Provided for the Spatstat Package}

<<echo=FALSE,results=hide,fig=FALSE>>=
options(SweaveHooks=list(fig=function() par(mar=c(1,1,1,1))))
@ 

\usepackage{graphicx}
\usepackage{anysize}
\marginsize{2cm}{2cm}{2cm}{2cm}

\newcommand{\pkg}[1]{\texttt{#1}}
\newcommand{\bold}[1]{{\textbf {#1}}}
\newcommand{\R}{{\sf R}}
\newcommand{\spst}{\pkg{spatstat}}
\newcommand{\Spst}{\pkg{Spatstat}}
\newcommand{\sdat}{\pkg{spatstat.data}}
\newcommand{\Sdat}{\pkg{Spatstat.data}}

\begin{document}
\bibliographystyle{plain}
\thispagestyle{empty}
\SweaveOpts{eps=TRUE}
\setkeys{Gin}{width=0.6\textwidth}

<<echo=FALSE,results=hide>>=
library(spatstat)
sdate <- read.dcf(file = system.file("DESCRIPTION", package = "spatstat"),
         fields = "Date")
sversion <- read.dcf(file = system.file("DESCRIPTION", package = "spatstat"),
         fields = "Version")
spatstat.options(transparent=FALSE)
options(useFancyQuotes=FALSE)
@ 

\title{Datasets provided for \spst}
\author{Adrian Baddeley, Rolf Turner and Ege Rubak}
\date{For \spst\ version \texttt{\Sexpr{sversion}}}
\maketitle

This document is an overview of the spatial datasets
that are provided for the \spst\ package. 

To flick through a nice display of all the data sets that come with
\spst\ type \texttt{demo(data)}.  To see information about a given
data set, type \texttt{help({\em name})} where \emph{name} is the
name of the data set.  To plot a given data set, 
type \texttt{plot({\em name})}.

Datasets in \spst\ are ``lazy-loaded'', which means that they can
be accessed simply by typing their name. Not all packages do this;
in some packages you have to type \texttt{data({\em name})} in
order to access a data set.

To list all the datasets in \spst, you need to type
\texttt{data(package="spatstat.data")}. This is because, 
for efficiency, the datasets are actually installed in a
sub-package \sdat. This is the only time you should ever need to
mention \sdat\ explicitly. When the \spst\ package 
is loaded by the command \texttt{library(spatstat)},
the sub-package \sdat\ is automatically loaded.

\section{List of datasets}

\subsection{Point patterns in 2D}

Here is a list of the standard point pattern data sets 
that are supplied with the current installation of \sdat:

\newcommand{\recto}{\framebox{\hphantom{re}\vphantom{re}}}
\newcommand{\irregpoly}{\includegraphics*[width=6mm]{irregpoly}}
\newcommand{\masque}{\includegraphics*[width=6mm]{mask}}
\newcommand{\convpoly}{\includegraphics*[width=4mm]{hexagon}}
\newcommand{\disc}{$\bigcirc$}
\newcommand{\nomarks}{$\cdot$}
\newcommand{\nocov}{$\cdot$}

\begin{tabular}{l|l|ccc}
{\sf name} & {\sf description} &
            {\sf marks} & {\sf covariates} & {\sf window} \\ \hline
{\tt amacrine} & rabbit amacrine cells &
            cell type & \nocov & \recto \\  
{\tt anemones} & sea anemones  & 
            diameter & \nocov & \recto \\
{\tt ants} & ant nests& 
            species & zones  & \convpoly \\
{\tt bdspots} & breakdown spots & 
           \nomarks           & \nocov & \disc \\
{\tt bei} & rainforest trees & 
           \nomarks           & topography & \recto \\
{\tt betacells} & cat retinal ganglia & 
            cell type, area & \nocov & \recto \\
{\tt bramblecanes} & bramble canes & 
            age & \nocov & \recto \\
{\tt bronzefilter} & bronze particles & 
            diameter & \nocov & \recto \\
{\tt btb} & bovine tuberculosis & 
            type, year & \nocov & \irregpoly \\
{\tt cells} & biological cells &
             \nomarks &\nocov & \recto \\
{\tt chorley} & cancers & 
            case/control &\nocov  & \irregpoly \\
{\tt clmfires} & forest fires & 
            cause, size, date & 
            \shortstack[c]{elevation, orientation,\\ slope, land use}  
            & \irregpoly \\
{\tt concrete} & air bubbles in concrete & 
             \nomarks & \nocov & \masque  \\
{\tt copper} & copper deposits & 
             \nomarks & fault lines & \recto  \\
{\tt demopat} & artificial data & 
             type & \nocov & \irregpoly \\
{\tt finpines} & trees & 
             diam, height & \nocov & \recto  \\
{\tt gordon} & people in a park & 
             \nomarks & \nocov & \irregpoly  \\
{\tt gorillas} & gorilla nest sites & 
             group, season & 
            \shortstack[c]{terrain, vegetation,\\ heat, water} & 
             \irregpoly  \\
{\tt hamster} & hamster tumour cells & 
              cell type &\nocov  & \recto \\
{\tt humberside} & child leukaemia & 
              case/control & \nocov & \irregpoly\\
{\tt hyytiala} & mixed forest & 
              species &\nocov  & \recto \\
{\tt japanesepines} & Japanese pines & \nomarks &\nocov & \recto \\
{\tt lansing} & mixed forest &
               species & \nocov & \recto \\
{\tt longleaf} & trees & 
              diameter & \nocov &  \recto \\
{\tt mucosa}   & gastric mucosa cells & 
              cell type & \nocov &  \recto \\
{\tt murchison} & gold deposits & \nomarks & faults, rock type & \irregpoly \\
{\tt nbfires} & wildfires & several & \nocov & \irregpoly \\
{\tt nztrees} & trees & \nomarks & \nocov & \recto \\
{\tt paracou} & trees & adult/juvenile & \nocov & \recto \\
{\tt ponderosa} & trees & \nomarks & \nocov & \recto \\
{\tt redwood} & saplings & \nomarks & \nocov & \recto \\
{\tt redwood3} & saplings & \nomarks & \nocov & \recto \\
{\tt redwoodfull} & saplings & 
              \nomarks & zones & \recto \\
{\tt shapley} & galaxies & magnitude, recession, SE & \nocov & \convpoly \\
{\tt simdat} & simulated pattern & \nomarks & \nocov & \recto \\
{\tt sporophores} & fungi & species & \nocov &  \disc \\
{\tt spruces} & trees & diameter & \nocov &  \recto \\
{\tt swedishpines} & trees & \nomarks & \nocov & \recto \\
{\tt urkiola} & mixed forest & species & \nocov & \irregpoly \\
{\tt vesicles} & synaptic vesicles & \nomarks & zones & \irregpoly \\
{\tt waka} & trees & diameter & \nocov & \recto \\
\hline
\end{tabular}

\bigskip
\noindent
The shape of the window containing the point pattern
is indicated by the symbols \recto\ (rectangle), 
\disc\ (disc), \convpoly\ (convex polygon), \irregpoly\ (irregular polygon)
and \masque (binary mask).

Additional information about the data set \texttt{\em name}
may be stored in a separate list \texttt{{\em name}.extra}.
Currently these are the available options:

\begin{tabular}[!h]{ll}
  {\sc Name} & {\sc Contents} \\ 
  \hline
  {\tt ants.extra} & field and scrub subregions; \\
                   & additional map elements; plotting function \\
  {\tt bei.extra} & covariate images \\
  {\tt chorley.extra} & incinerator location; plotting function \\
  {\tt gorillas.extra} & covariate images\\
  {\tt nbfires.extra} & inscribed rectangle; border type labels \\
  {\tt ponderosa.extra} & data points of interest; plotting function\\
  {\tt redwoodfull.extra} & subregions; plotting function \\
  {\tt shapley.extra} & individual survey fields; plotting function \\
  {\tt vesicles.extra} & anatomical regions \\
  \hline
\end{tabular}

For demonstration and instruction purposes, 
raw data files are available for the datasets 
\texttt{vesicles}, \texttt{gorillas} and \texttt{osteo}.

\subsection{Other Data Types}

There are also the following spatial data sets which are not 2D point patterns:

\begin{tabular}[c]{l|l|l}
{\sf name} & {\sf description} & {\sf format} \\ \hline
{\tt austates} & Australian states & tessellation \\
{\tt cetaceans} & marine survey & replicated 2D point patterns \\
{\tt chicago} & crimes & point pattern on linear network \\
{\tt demohyper} & simulated data & replicated 2D point patterns with covariates\\
{\tt dendrite} & dendritic spines & point pattern on linear network \\
{\tt flu} & virus proteins & replicated 2D point patterns \\
{\tt heather} & heather mosaic & binary image (three versions) \\
{\tt osteo} & osteocyte lacunae & replicated 3D point patterns with covariates\\
{\tt pyramidal} & pyramidal neurons & replicated 2D point patterns in 3 groups\\
{\tt residualspaper} 
                & data \& code from Baddeley et al (2005) &  
                       2D point patterns, \R\ function \\
{\tt simba} & simulated data & replicated 2D point patterns in 2 groups\\
{\tt spiders} & spider webs & point pattern on linear network \\
{\tt waterstriders} & insects on water & replicated 2D point patterns\\
\hline
\end{tabular}

Additionally there is a dataset \texttt{Kovesi} containing
several colour maps with perceptually uniform contrast. 

\section{Information on each dataset}

Here we give basic information about each dataset.
For further information, consult the help file for the 
particular dataset.

<<echo=FALSE>>=
opa <- par()
## How to set all margins to zero and eliminate all outer spaces
zeromargins <- function() {
  par(
      mar=rep(0,4),
      omd=c(0,1,0,1),
      xaxs="i",
      yaxs="i"
  )
  invisible(NULL)
}
## Set 'mar'
setmargins <- function(...) {
  x <- c(...)
  x <- rep(x, 4)[1:4]
  par(mar=x)
  invisible(NULL)
}
@ 

\subsubsection*{\texttt{amacrine}: Amacrine cells}

Locations of displaced amacrine cells in the retina of a rabbit.
There are two types of points, ``on'' and ``off''.

\SweaveOpts{width=5.5,height=3}\setkeys{Gin}{width=0.8\textwidth}
<<eval=FALSE>>=
plot(amacrine)
@ 
<<fig=TRUE,echo=FALSE,results=hide>>=
setmargins(0,1,2,0)
plot(amacrine)
@ 

\subsubsection*{\texttt{anemones}: Sea Anemones}

These data give the spatial locations and diameters
of sea anemones on a boulder near sea level.

\SweaveOpts{width=7,height=4.5}\setkeys{Gin}{width=0.8\textwidth}
<<eval=FALSE>>=
plot(anemones, markscale=1)
@ 
<<fig=TRUE,echo=FALSE,results=hide>>=
setmargins(0,0,2,0)
plot(anemones, markscale=1)
@ 

\subsubsection*{\texttt{ants}: Ants' nests}

Spatial locations of nests of two species of
ants at a site in Greece.
The full dataset (supplied here) has an irregular polygonal boundary,
while most analyses have been confined to two rectangular
subsets of the pattern (also supplied here).

% Parameters for Ants data with key at right
\SweaveOpts{width=6.3,height=4}\setkeys{Gin}{width=0.7\textwidth}
<<eval=FALSE>>=
ants.extra$plotit()
@ %$
<<fig=TRUE,echo=FALSE,results=hide>>=
setmargins(0,0,1,0)
ants.extra$plotit()
@ %$

\subsubsection*{\texttt{austates}: Australian states}

  The states and large mainland territories of Australia are
  represented as polygonal regions forming a tessellation.

<<fig=TRUE>>=
plot(austates)
@   

\subsubsection*{\texttt{bdspots}: Breakdown spots}

A list of three point patterns, each giving the locations of
electrical breakdown spots on a circular electrode in
a microelectronic capacitor.

\SweaveOpts{width=12,height=6}\setkeys{Gin}{width=\textwidth}
<<eval=FALSE>>=
plot(bdspots, equal.scales=TRUE, pch="+", 
     panel.args=function(i)list(cex=c(0.15, 0.2, 0.7)[i]))
@   
<<fig=TRUE,echo=FALSE>>=
zeromargins()
plot(bdspots, equal.scales=TRUE, pch="+", main="",
     mar.panel=0, hsep=1,
     panel.args=function(i)list(cex=c(0.15, 0.2, 0.7)[i]))
@   

\subsubsection*{\texttt{bei}: Beilschmiedia data}

Locations of 3605 trees in a tropical rain forest.
Accompanied by covariate data giving the elevation (altitude)
and slope of elevation in the study region.
  
\SweaveOpts{width=12,height=6}\setkeys{Gin}{width=0.8\textwidth}
<<eval=FALSE>>=
plot(bei.extra$elev, main="Beilschmiedia")
plot(bei, add=TRUE, pch=16, cex=0.3)
@ 
<<fig=TRUE,echo=FALSE,results=hide>>=
setmargins(0,0,2,0)
plot(bei.extra$elev, main="Beilschmiedia")
plot(bei, add=TRUE, pch=16, cex=0.3)
@ 

The following command gives a perspective display
similar to the front cover of Baddeley, Rubak and Turner (2015):

<<eval=FALSE>>=
M <- persp(bei.extra$elev, 
           theta=-45, phi=18, expand=7,
           border=NA, apron=TRUE, shade=0.3, 
           box=FALSE, visible=TRUE,
           main="")
perspPoints(bei, Z=bei.extra$elev, M=M, pch=16, cex=0.3)
@ 

\subsubsection*{\texttt{betacells}: Beta ganglion cells}

Locations of beta ganglion cells in cat retina,
each cell classified as `on' or `off'
and also labelled with the cell profile area.
  
<<fig=TRUE>>=
plot(betacells)
@ 

\subsubsection*{\texttt{bramblecanes}: Bramble canes}

<<fig=TRUE>>=
plot(bramblecanes, cols=1:3)
@ 

Try the following 

<<eval=FALSE>>=
plot(split(bramblecanes))
@ 

\subsubsection*{\texttt{bronzefilter}: Bronze filter section profiles}

Spatially inhomogeneous pattern of
circular section profiles of particles, observed in a
longitudinal plane section through a gradient sinter
filter made from bronze powder.

<<fig=TRUE>>=
plot(bronzefilter,markscale=2)
@ 

\subsubsection*{\texttt{btb}: bovine tuberculosis}

Locations of farms where bovine tuberculosis was detected,
marked by year of detection and spoligotype of tuberculosis.

<<fig=TRUE>>=
plot(btb, which.marks="spoligotype", cols=2:5, chars=1:4)
@ 

\subsubsection*{\texttt{cells}: Biological cells}

Locations of the centres of 42 biological cells
observed under optical microscopy in a histological section.
Often used as a demonstration example.

<<fig=TRUE>>=
plot(cells)
@ 

\subsubsection*{\texttt{cetaceans}: Survey of marine species}

Recorded sightings of whales, dolphins and other marine species
in a series of surveys. Replicated 2D marked point patterns.

<<fig=TRUE>>=
plot(cetaceans.extra$patterns, main="Cetaceans data", cols=1:5, hsep=1)
@ 

\subsubsection*{\texttt{chicago}: Chicago crimes}

Locations (street addresses) of crimes reported in a two-week period
in an area close to the University of Chicago.
A multitype point pattern on a linear network.

<<fig=TRUE>>=
plot(chicago, main="Chicago Crimes", col="grey",
     cols=c("red", "blue", "black", "blue", "red", "blue", "blue"),
     chars=c(16,2,22,17,24,15,6), leg.side="left", show.window=FALSE)
@ 

\subsubsection*{\texttt{chorley}: Chorley-Ribble cancer data}

Spatial locations of cases of cancer of the larynx
and cancer of the lung, and the location of a disused industrial
incinerator. A marked point pattern, with an irregular window
and a simple covariate.

<<fig=TRUE>>=
chorley.extra$plotit()
@ %$

\subsubsection*{\texttt{clmfires}: Castilla-La Mancha Fires}

Forest fires in the Castilla-La Mancha
region of Spain between 1998 and 2007.
A point pattern with 4 columns of marks:

\begin{tabular}{ll}
  \texttt{cause} & cause of fire\\ 
  \texttt{burnt.area} & total area burned, in hectares \\
  \texttt{date} & date of fire \\
  \texttt{julian.date} & date of fire in days since 1.1.1998
\end{tabular}
  
<<fig=TRUE>>=
plot(clmfires, which.marks="cause", cols=2:5, cex=0.25,
     main="Castilla-La Mancha forest fires")
@ 

The accompanying dataset \texttt{clmfires.extra} is a list
of two items \texttt{clmcov100} and \texttt{clmcov200} containing covariate
information for the entire Castilla-La Mancha region. Each
of these two elements is a list of four pixel images 
named \texttt{elevation}, \texttt{orientation},
\texttt{slope} and \texttt{landuse}. 

<<fig=TRUE>>=
plot(clmfires.extra$clmcov100$elevation, main="Elevation")
@ %$ 

\subsubsection*{\texttt{concrete}: Air bubbles in concrete}

Prof.\ Shin-ichi Igarashi's data:  a point pattern of the locations
of centroids of air bubbles seen in a cross-section of concrete.
Air bubbles are present in the matrix of cement paste
which surrounds the particles of aggregate. The outline of the aggregate,
and the locations of the centroids of the bubble profiles, are recorded.

<<fig=TRUE>>=
plot(concrete,chars="+",cols="blue",col="yellow")
@ 

\subsubsection*{\texttt{copper}: Queensland copper data}

These data come from an intensive geological survey 
in central Queensland, Australia.
They consist of 67 points representing copper ore deposits,
and 146 line segments representing geological `lineaments',
mostly faults. 

<<fig=TRUE>>=
plot(copper$Points, main="Copper")
plot(copper$Lines, add=TRUE)
@ 

\subsubsection*{\texttt{demohyper}}

A synthetic example of a \texttt{hyperframe} for demonstration purposes.

<<fig=TRUE>>=
plot(demohyper, quote({ plot(Image, main=""); plot(Points, add=TRUE) }),
      parargs=list(mar=rep(1,4)))
@ 

\subsubsection*{\texttt{demopat}}

A synthetic example of a point pattern for demonstration purposes.

<<fig=TRUE>>=
plot(demopat)
@ 

\subsubsection*{\texttt{dendrite}}

  Dendrites are branching filaments which extend from the
  main body of a neuron (nerve cell) to propagate electrochemical
  signals. Spines are small protrusions on the dendrites.

  This dataset gives the locations of 566 spines
  observed on one branch of the dendritic tree of a rat neuron.
  The spines are classified according to their shape into three types:
  mushroom, stubby or thin.

<<fig=TRUE>>=
plot(dendrite, leg.side="bottom", main="", cex=0.75, cols=2:4)
@ 

\subsubsection*{\texttt{finpines}: Finnish pine saplings}

Locations of 126 pine saplings
in a Finnish forest, their heights and their diameters.

<<fig=TRUE>>=
plot(finpines, main="Finnish pines")
@ 

\subsubsection*{\texttt{flu}: Influenza virus proteins}

  The \texttt{flu} dataset contains
  replicated spatial point patterns giving the locations of two
  different virus proteins on the membranes of cells infected with
  influenza virus.
  
  It is a \texttt{hyperframe} containing
  point patterns and explanatory variables.
  
<<fig=TRUE>>=
wildM1 <- with(flu, virustype == "wt" & stain == "M2-M1")
plot(flu[wildM1, 1, drop=TRUE],
     main=c("flu data", "wild type virus, M2-M1 stain"),
     chars=c(16,3), cex=0.4, cols=2:3)
@ 

\subsubsection*{\texttt{gordon}: People in Gordon Square}

Locations of people sitting on a grass patch on a sunny afternoon.

  
<<fig=TRUE>>=
plot(gordon, main="People in Gordon Square", pch=16)
@ 

\subsubsection*{\texttt{gorillas}: Gorilla nesting sites}

 Locations of nesting sites of gorillas, and associated covariates,
  in a National Park in Cameroon.  
  
  \texttt{gorillas} is a marked point pattern (object
  of class \texttt{"ppp"}) representing nest site locations.

  \texttt{gorillas.extra} is a named list of 7 pixel images (objects of
  class \texttt{"im"}) containing spatial covariates.
  It also belongs to the class \texttt{"listof"}.
  
<<fig=TRUE>>=
plot(gorillas, which.marks=1, chars=c(1,3), cols=2:3, main="Gorilla nest sites")
@ 

The \texttt{vegetation} covariate is also available as a raw ASCII format file,
<<eval=FALSE>>=
system.file("rawdata/gorillas/vegetation.asc", package="spatstat")
@ 

\subsubsection*{\texttt{hamster}: Hamster kidney cells}

 Cell nuclei in hamster kidney, each nucleus classified as
 either `dividing' or `pyknotic'.
 A multitype point pattern.
 
<<fig=TRUE>>=
plot(hamster, cols=c(2,4))
@ 

\subsubsection*{\texttt{heather}: Heather mosaic}

The spatial mosaic of vegetation of the heather plant,
recorded in a 10 by 20 metre sampling plot in Sweden.
A list with three entries, representing the same data at
different spatial resolutions.
  
<<fig=TRUE>>=
plot(heather$coarse)
@ 

Type the following to see all three images:
<<eval=FALSE>>=
plot(heather)
@ 

\subsubsection*{\texttt{humberside}: Childhood Leukemia and Lymphoma}

Spatial locations of cases of childhood leukaemia
and lymphoma, and randomly-selected controls,
in North Humberside.
A marked point pattern.

<<fig=TRUE>>=
plot(humberside)
@ 

The dataset \texttt{humberside.convex} is an object of the
same format, representing the same point pattern data,
but contained in a larger, 5-sided convex polygon.

\subsubsection*{\texttt{hyytiala}: Mixed forest}

Spatial locations and species classification for
trees in a Finnish forest.

<<fig=TRUE>>=
plot(hyytiala, cols=2:5)
@ 

\subsubsection*{\texttt{japanesepines}: Japanese black pine saplings}

Locations of Japanese black pine saplings
in a square sampling region in a natural forest.
Often used as a standard example.

<<fig=TRUE>>=
plot(japanesepines)
@ 

\subsubsection*{\texttt{lansing}: Lansing Woods}

Locations and botanical classification of trees in a forest.
A multitype point pattern with 6 different types of points.
Includes duplicated points.

<<fig=TRUE>>=
plot(lansing)
@ 

Type the following to see 6 plots, each showing the location
of one of the types of points:

<<eval=FALSE>>=
plot(split(lansing))
@ 

\subsubsection*{\texttt{longleaf}: Longleaf Pines}

Locations and diameters of Longleaf pine trees.
  
<<fig=TRUE>>=
plot(longleaf)
@ 

\subsubsection*{\texttt{mucosa}: Gastric Mucosa Cells}

A bivariate inhomogeneous point pattern, giving the locations of
the centres of two types of cells in a cross-section of the
gastric mucosa of a rat.
  
<<fig=TRUE>>=
plot(mucosa, chars=c(1,3), cols=c("red", "green"))
plot(mucosa.subwin, add=TRUE, lty=3)
@ 

\subsubsection*{\texttt{murchison}: Murchison Gold Deposits}

Spatial locations of gold deposits and associated
geological features in the Murchison area of Western Australia.
A list of three elements:
\begin{itemize}
\item \texttt{gold}, the point pattern of gold deposits;
\item \texttt{faults}, the line segment pattern of geological faults;
\item \texttt{greenstone}, the subregion of greenstone outcrop.
\end{itemize}

Type the following to see the full Murchison dataset:

<<fig=TRUE>>=
plot(murchison$greenstone, main="Murchison data", col="lightgreen")
plot(murchison$gold, add=TRUE, pch=3, col="blue")
plot(murchison$faults, add=TRUE, col="red")
@ 

Some analysis of the data uses a rectangle close to the abandoned town
of Reedy:

<<>>=
reedy <- owin(c(580, 650), c(6986, 7026))
@ 

Here are the data in that area:

<<fig=TRUE>>=
plot(murchison$greenstone[reedy], main="Murchison data", col="lightgreen")
plot(murchison$gold[reedy], add=TRUE, pch=3, col="blue")
plot(murchison$faults[reedy], add=TRUE, col="red")
@ 

\subsubsection*{\texttt{nbfires}: New Brunswick Fires}

Fires in New Brunswick (Canada) 
with marks giving information about each fire.

<<fig=TRUE>>=
plot(nbfires, use.marks=FALSE, pch=".")
@ 

The following command would show the data for each year
in a separate panel:

<<eval=FALSE>>=
plot(split(nbfires), use.marks=FALSE, chars=".")
@ 

<<fig=TRUE>>=
par(mar=c(0,0,2,0))
plot(split(nbfires)$"2000", which.marks="fire.type",
     main=c("New Brunswick fires 2000", "by fire type"),
     cols=c("blue", "green", "red", "cyan"),
     leg.side="left")
@ 

\subsubsection*{\texttt{nztrees}: New Zealand Trees}

Locations of trees in a forest plot in New Zealand.
Often used as a demonstration example.

<<fig=TRUE>>=
plot(nztrees)
plot(trim.rectangle(as.owin(nztrees), c(0,5), 0), add=TRUE, lty=3)
@ 

\subsubsection*{\texttt{osteo}: Osteocyte Lacunae}

Replicated three-dimensional point patterns:
the three-dimensional locations of 
  osteocyte lacunae observed in rectangular volumes of
  solid bone using a confocal microscope.
A \texttt{hyperframe} containing 3D point patterns
and explanatory variables.
  
  
<<fig=TRUE>>=
plot(osteo[1:4,], main.panel="", pch=21, bg='white')
@ 

For demonstration and instruction purposes, the 
raw data from the 36th point pattern are available in a plain ascii file in the
\texttt{spatstat} installation,
<<eval=FALSE>>=
system.file("rawdata/osteo/osteo36.txt", package="spatstat")
@ 

\subsubsection*{\texttt{paracou}: Kimboto trees}

Point pattern of adult and juvenile Kimboto trees
recorded at Paracou in French Guiana.
A bivariate point pattern.

<<fig=TRUE>>=
plot(paracou, cols=2:3, chars=c(16,3))
@ 

\subsubsection*{\texttt{ponderosa}: Ponderosa Pines}

Locations of Ponderosa Pine trees in a forest.
Several special points are identified.

<<fig=TRUE>>=
ponderosa.extra$plotit()
@  %$

\subsubsection*{\texttt{pyramidal}: Pyramidal Neurons in Brain}

Locations of pyramidal neurons in sections of human brain.
There is one point pattern from each of 31 human subjects.
The subjects are divided into three groups:
controls (12 subjects), schizoaffective (9  subjects)
and schizophrenic (10 subjects).

To reduce space, we show only the odd-numbered patterns:
<<>>=
pyr <- pyramidal[c(FALSE,TRUE), ]
@ 

<<fig=TRUE>>=
pyr$grp <- abbreviate(pyr$group, minlength=7)
plot(pyr, quote(plot(Neurons, pch=16, main=grp)), main="Pyramidal Neurons")
@ 

\subsubsection*{\texttt{redwood}, \texttt{redwood3}, \texttt{redwoodfull}: Redwood seedlings and saplings}

California Redwood seedlings and saplings in a forest.
There are two versions of this dataset:
\texttt{redwood} and \texttt{redwoodfull}.

The \texttt{redwoodfull} dataset is the full data.
It is spatially inhomogeneous in density and spacing of points.

The \texttt{redwood} dataset is a subset of the full data,
selected because it is apparently homogeneous, and has often 
been used as a demonstration example. This comes in two versions
commonly used in the literature:
\texttt{redwood} (coordinates given to 2 decimal places)
and \texttt{redwood3} (coordinates given to 3 decimal places).


<<fig=TRUE>>=
plot(redwood)
plot(redwood3, add=TRUE, pch=20)
@ 

<<fig=TRUE>>=
redwoodfull.extra$plotit()
@ %$

\subsubsection*{\texttt{residualspaper}: Data from residuals paper}

Contains the point patterns used as examples in 
\begin{quote}
  A. Baddeley, R. Turner, J. M{\o}ller and M. Hazelton (2005)
  Residual analysis for spatial point processes.
  \emph{Journal of the Royal Statistical Society, Series B}
  \textbf{67}, 617--666
\end{quote}
along with {\sf R} code.

<<fig=TRUE>>=
plot(as.solist(residualspaper[c("Fig1", "Fig4a", "Fig4b", "Fig4c")]), 
     main="")
@ 

\subsubsection*{\texttt{shapley}: Shapley Galaxy Concentration}

Sky positions of 4215 galaxies in the Shapley Supercluster
(mapped by radioastronomy).

<<fig=TRUE>>=
shapley.extra$plotit(main="Shapley")
@  %$

\subsubsection*{\texttt{simdat}: Simulated data}

Another simulated dataset used for demonstration purposes.

<<fig=TRUE>>=
plot(simdat)
@ 

\subsubsection*{\texttt{spiders}: Spider webs}

Spider webs across the mortar lines of a brick wall. 
A point pattern on a linear network.

<<fig=TRUE>>=
plot(spiders, pch=16, show.window=FALSE)
@ 

\subsubsection*{\texttt{sporophores}: Sporophores}

Sporophores of three species of fungi around a tree.

<<fig=TRUE>>=
plot(sporophores, chars=c(16,1,2), cex=0.6)
points(0,0,pch=16, cex=2)
text(15,8,"Tree", cex=0.75)
@ 

\subsubsection*{\texttt{spruces}: Spruces in Saxony}

Locations of Norwegian spruce trees 
in a natural forest stand in Saxonia, Germany.
Each tree is marked with its diameter at breast height.
 
<<fig=TRUE>>=
plot(spruces, maxsize=min(nndist(spruces)))
@ 

\subsubsection*{\texttt{swedishpines}: Swedish Pines}

Locations of pine saplings
in a Swedish forest.
Often used as a demonstration example.

<<fig=TRUE>>=
plot(swedishpines)
@ 

\subsubsection*{\texttt{urkiola}: trees in a wood}

Locations of birch and oak trees  in a secondary wood in
Urkiola Natural Park (Basque country, northern Spain). 
Irregular window, bivariate point pattern.

<<fig=TRUE>>=
plot(urkiola, cex=0.5, cols=2:3)
@ 

\subsubsection*{\texttt{waka}: trees in Waka National Park}

Spatial coordinates of each tree, marked by the tree diameter at breast height.
    
<<fig=TRUE>>=
par(mar=c(0,0,2,0))
plot(waka, markscale=0.04, main=c("Waka national park", "tree diameters"))
@ 

\subsubsection*{\texttt{vesicles}: synaptic vesicles}

Point pattern of synaptic vesicles observed in rat brain tissue.

<<fig=TRUE>>=
v <- rotate(vesicles, pi/2)
ve <- lapply(vesicles.extra, rotate, pi/2)
plot(v, main="Vesicles")
plot(ve$activezone, add=TRUE, lwd=3)
@ 

The auxiliary dataset \texttt{vesicles.extra} is a list with entries\\ 
\begin{tabular}{ll}
  \texttt{presynapse} & outer polygonal boundary of presynapse \\
  \texttt{mitochondria} & polygonal boundary of mitochondria \\
  \texttt{mask} & binary mask representation of vesicles window \\
  \texttt{activezone} & line segment pattern representing the active zone.
\end{tabular}

For demonstration and training purposes,
the raw data files for this dataset are also
provided in the \pkg{spatstat} package installation:\\ 
\begin{tabular}{ll}
  \texttt{vesicles.txt} &  spatial locations of vesicles \\
  \texttt{presynapse.txt} &  vertices of \texttt{presynapse} \\
  \texttt{mitochondria.txt}  &  vertices of \texttt{mitochondria} \\
  \texttt{vesiclesimage.tif}  &  greyscale microscope image \\
  \texttt{vesiclesmask.tif}  &  binary image of \texttt{mask} \\
  \texttt{activezone.txt}  &  coordinates of \texttt{activezone} 
\end{tabular}
The files are in the folder \texttt{rawdata/vesicles} in the
\texttt{spatstat} installation directory. The precise location of the
files can be obtained using \texttt{system.file}, for example
<<eval=FALSE>>=
system.file("rawdata/vesicles/mitochondria.txt", package="spatstat")
@ 

\subsubsection*{\texttt{waterstriders}: Insects on a pond}

Three independent replications of a point pattern
formed by insects on the surface of a pond.
  
<<fig=TRUE>>=
plot(waterstriders)
@ 

\end{document}

