disp.plot: Plotting of irregular spaced matrix data with aribitary...

Description Usage Arguments Details Value Author(s) See Also Examples

Description

Polygon 2D plotting of irregular spaced matrix data with aribitary transformations.

Usage

1
2
disp.plot(x, y, z, fx = nothing_x, fy = nothing_y, nx = length(unique(x)),
  ny = length(unique(y)), method = "bilinear", return_data = F, ...)

Arguments

x

x vector

y

y vector

z

z vector

fx

function of x and y returning the functional transformation of the x-axis

fy

function of x and y returning the functional transformation of the y-axis

nx, ny

The square image will be constructed from nx by ny polygons. If nx and ny are equal to the defaults, length(unique(x)) and length(unique(y)), the plot produced will be a standard (uninterpolated) colorplot. Higher values of nx and ny will produce smoother plots.

method

Specifies the interpolation method to use. Default is 'bilinear' using akima::interp, you can also use 'bicubic' (from akima::bicubic.grid).

return_data

Returns a list of the three matricies used for image.plot

...

The usual arguments to the image function as x,y,or z or as a list with x,y,z as components. One can also include a breaks argument for an unequal color scale with color scale boundaries at the breaks (see example in the image.plot documentation).

Details

In this function fx and fy are passed as functions, not raw vectors. See the examples for how to use this method to plot dispersion. nothing_x(x,y) and nothing_y(x,y) are the default functions for transformations, and do nothing (i.e. return x and y respectivley)

Value

Returns an image plot of the data

Author(s)

Tom Constant

See Also

image.plot, interp, bicubic.grid

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
data(SPPdispersion)

x<-SPPdispersion$wavelength*1e9
y<-SPPdispersion$angle
z<-SPPdispersion$reflection

kx<-function(x,y) (2*pi/(x*1e-9))*sin(y*pi/180)
omega<-function(x,y) 2*pi*3e8/(x*1e-9)

disp.plot(x,y,z)

disp.plot(x,y,z,fx=kx,fy=omega,nx=200,ny=200,method="bicubic")

# Polar Coordinates example

# Edit SPPdisperison to vary from wavelength from 0 to 400 and angle 0 to 360 degrees
# Note, apart from the example, theres absolutley no reason to do this

x <- SPPdispersion$wavelength*1e9-400
y <- 359*(SPPdispersion$angle-min(SPPdispersion$angle))/(max(SPPdispersion$angle)-min(SPPdispersion$angle))
z <- SPPdispersion$reflection

# Polar Coordinate Transform
fx <- function(x,y) x*sin(y*pi/180)
fy <- function(x,y) x*cos(y*pi/180)

disp.plot(x,y,z,fx,fy,nx=300,ny=300,method = "bicubic")

tjconstant/disp.plot documentation built on May 31, 2019, 3:38 p.m.