plotBubbles: Construct a Bubble Plot from a Matrix

Description Usage Arguments Details Author(s) See Also Examples

View source: R/plotFuns.r

Description

Construct a bubble plot for a matrix z.

Usage

1
2
3
plotBubbles(z, xval=FALSE, yval=FALSE, dnam=FALSE, rpro=FALSE, 
   cpro=FALSE, rres=FALSE, cres=FALSE, powr=0.5, size=0.2, lwd=1,
   clrs=c("black","red","blue"), hide0=FALSE, frange=0.1, prettyaxis=FALSE, ...) 

Arguments

z

input matrix, array (2 dimensions) or data frame.

xval

x-values and/or labels for the columns of z. if xval=TRUE, the first row contains x-values for the columns.

yval

y-values and/or labels for the rows of z. If yval=TRUE, the first column contains y-values for the rows.

dnam

logical: if TRUE, attempt to use dimnames of input matrix z as xval and yval. The dimnames are converted to numeric values and must be strictly increasing or decreasing. If successful, these values will overwrite previously specified values of xval and yval or any default indices.

rpro

logical: if TRUE, convert rows to proportions.

cpro

logical: if TRUE, convert columns to proportions.

rres

logical: if TRUE, use row residuals (subtract row means).

cres

logical: if TRUE, use column residuals (subtract column means).

powr

power transform. Radii are proportional to z^powr. Note: powr=0.5 yields bubble areas proportional to z.

size

size (inches) of the largest bubble.

lwd

line width for drawing circles.

clrs

colours (3-element vector) used for positive, negative, and zero values, respectively.

hide0

logical: if TRUE, hide zero-value bubbles.

frange

number specifying the fraction by which the range of the axes should be extended.

prettyaxis

logical: if TRUE, apply the pretty function to both axes.

...

additional arguments for plotting functions.

Details

The function plotBubbles essentially flips the z matrix visually. The columns of z become the x-values while the rows of z become the y-values, where the first row is displayed as the bottom y-value and the last row is displayed as the top y-value. The function's original intention was to display proportions-at-age vs. year.

Author(s)

Jon T. Schnute, Pacific Biological Station, Fisheries and Oceans Canada, Nanaimo BC

See Also

genMatrix

Examples

1
2
3
4
5
6
7
8
local(envir=.PBSmodEnv,expr={
  oldpar = par(no.readonly=TRUE)
  plotBubbles(round(genMatrix(40,20),0),clrs=c("green","grey","red"));
  data(CCA.qbr,envir=.PBSmodEnv)
  plotBubbles(CCA.qbr,cpro=TRUE,powr=.5,dnam=TRUE,size=.15,
    ylim=c(0,70),xlab="Year",ylab="Quillback Rockfish Age")
  par(oldpar)
})

Example output

sh: 1: cannot create /dev/null: Permission denied

-----------------------------------------------------------
PBS Modelling 2.68.6 -- Copyright (C) 2005-2018 Fisheries and Oceans Canada

A complete user guide 'PBSmodelling-UG.pdf' is located at 
/usr/lib/R/site-library/PBSmodelling/doc/PBSmodelling-UG.pdf

Packaged on 2017-12-19
Pacific Biological Station, Nanaimo

All available PBS packages can be found at
https://github.com/pbs-software
-----------------------------------------------------------



~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

ERROR: Your system failed to load Tk, the widget toolkit required for
PBSmodelling.  See the R FAQ for your operating system at
        http://cran.r-project.org/faqs.html
for suggestions on resolving issues with Tcl/Tk.

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Warning message:
no DISPLAY variable so Tk is not available 

PBSmodelling documentation built on Dec. 27, 2017, 5:03 p.m.