tplot: Plot ternary forecasts in barycentric coordinates.

Description Usage Arguments Author(s) Examples

Description

This function is almost exactly the same as the ternaryplot function in package vcd (on which it is based) except that the ordering of the vertices has been change to bottom left/top/bottom right, and the code has been extended work for an aribtrary scoring matrix L.

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
tplot(x = cbind(1, 1, 1)/3, L = diag(c(1, 1, 1))/sqrt(2), 
      scale = 1, dimnames = NULL, 
      dimnames_position = c("corner", "none"), 
      dimnames_color = "black", id = NULL, id_color = "black", 
      coordinates = FALSE, grid = TRUE, grid_color = "gray", 
      labels = c("inside", "outside", "none"), 
      labels_color = "darkgray", border = "grey", 
      bg = "white", pch = 19, cex = 1, prop_size = FALSE, 
      col = "red", main = "ternary plot", sub = NULL, 
      newpage = TRUE, pop = TRUE, col.main = "black", 
      col.sub = "black", ...)

Arguments

x

an n-by-3 matrix of ternary forecasts.

L

A matrix describing the quadratic score function. (Default corresponds to the Brier score).

scale

row sums scale to be used.

dimnames

dimension labels (defaults to the column names of x.

dimnames_position, dimnames_color

position and color of dimension labels.

id

optional labels to be plotted below the plot symbols. coordinates and id are mutually exclusive.

id_color

color of these labels.

coordinates

if TRUE, the coordinates of the points are plotted below them. coordinates and id are mutually exclusive.

grid

if TRUE, a grid is plotted. May optionally be a string indicating the line type (default: "dotted").

grid_color

grid colour.

labels, labels_color

position and colour of the grid labels.

border

colour of the triangle border.

bg

triangle background.

pch

plotting character. Defaults to filled dots.

cex

a numerical value giving the amount by which plotting text and symbols should be scaled relative to the default. Ignored for the symbol size if prop_size is not FALSE.

prop_size

if TRUE, the symbol size is plotted proportional to the row sum of the three variables, i.e., represents the weight of the observation.

col

plotting colour.

main

main title.

sub

a sub title.

newpage

if ‘TRUE’, the plot will appear on a new graphics page.

pop

logical; if ‘TRUE’, all newly generated viewports are popped after plotting.

col.main

colour for the title.

col.sub

colour for the sub title.

...

additional graphics parameters (see par).

Author(s)

Tim Jupp (using code for vcd:ternaryplot as source).

Examples

1
2
3
tg <- tgrid(6) # make a grid of forecasts in the triangle
tg             # print to terminal
tplot(tg)      # plot them

Example output

Loading required package: grid
Loading required package: quadprog
Loading required package: maps
Loading required package: maptools
Loading required package: sp
Checking rgeos availability: FALSE
 	Note: when rgeos is not available, polygon geometry 	computations in maptools depend on gpclib,
 	which has a restricted licence. It is disabled by default;
 	to enable gpclib, type gpclibPermit()
Loading required package: mapdata
Loading required package: dichromat
           [,1]      [,2]      [,3]
 [1,] 0.0000000 0.0000000 1.0000000
 [2,] 0.0000000 0.1666667 0.8333333
 [3,] 0.0000000 0.3333333 0.6666667
 [4,] 0.0000000 0.5000000 0.5000000
 [5,] 0.0000000 0.6666667 0.3333333
 [6,] 0.0000000 0.8333333 0.1666667
 [7,] 0.0000000 1.0000000 0.0000000
 [8,] 0.1666667 0.0000000 0.8333333
 [9,] 0.1666667 0.1666667 0.6666667
[10,] 0.1666667 0.3333333 0.5000000
[11,] 0.1666667 0.5000000 0.3333333
[12,] 0.1666667 0.6666667 0.1666667
[13,] 0.1666667 0.8333333 0.0000000
[14,] 0.3333333 0.0000000 0.6666667
[15,] 0.3333333 0.1666667 0.5000000
[16,] 0.3333333 0.3333333 0.3333333
[17,] 0.3333333 0.5000000 0.1666667
[18,] 0.3333333 0.6666667 0.0000000
[19,] 0.5000000 0.0000000 0.5000000
[20,] 0.5000000 0.1666667 0.3333333
[21,] 0.5000000 0.3333333 0.1666667
[22,] 0.5000000 0.5000000 0.0000000
[23,] 0.6666667 0.0000000 0.3333333
[24,] 0.6666667 0.1666667 0.1666667
[25,] 0.6666667 0.3333333 0.0000000
[26,] 0.8333333 0.0000000 0.1666667
[27,] 0.8333333 0.1666667 0.0000000
[28,] 1.0000000 0.0000000 0.0000000

ternvis documentation built on July 5, 2019, 5:03 p.m.