Description Usage Arguments Value Examples
Takes x,y,z co-ordinates and plots them on a contour map. Smoothing and interpolation is done by means of fitting a spline to the data.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 |
x |
a vector of x co-ordinates |
y |
a vector of y co-ordinates |
z |
a vector of z co-ordinates representing the height of the contours |
nx |
The number of pixels that will be in final plot. default is length(unique(x)) |
main |
Title of plot |
axis |
logical if TRUE displays the axes of the plot |
legend |
logical if TRUE displays the legend |
xlab |
label on x axis |
ylab |
label on y axis |
col |
list of colors to be applied to contours. |
breaks |
list of values indicating the contour ranges |
nlevels |
useful if breaks and col are left as null. Sets the number of levels of the contours to be plotted |
legend_pos |
set position of the colour bar. Default = 4. |
A contour plot (similar to those in base, additional elements can be added using lines, points functions etc.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 | x <- Volcontour$x
y <- Volcontour$y
z <- Volcontour$z
contourPlot(x = x, y = y, z = z)
# A smoother contour
contourPlot(x = x, y = y, z = z, nx = 500)
# Changing breaks and colours
breaks = pretty(c(min(z),max(z)))
col = brewer.pal(n = length(breaks)-1, "Blues")
contourPlot(x = x, y = y, z = z, nx = 500, breaks = breaks, col = col)
# add lines
lines(circle(0, 0, 26.5))
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.