Description Usage Arguments Details Author(s) Examples
This function is intended to draw xy-plots or barplots in existing maps or other plots.
1 2 |
x, y |
vectors with x and y-locations of the centre of the xy-plots. |
xx, yy |
vectors (of the same length as |
xlim, ylim |
the x and y-limits of the xy-plots. the same limits will apply to all xyplots. Defaults to |
width, height |
the width and height of the xy-plot area (coordinate units of the main map or plot). |
bg |
background colour of the xy-plots |
border |
the colour of the border of the xy-plots. |
type |
the type of plot. See |
col |
a single colour or a vector of colours (same length as |
silent |
logical, should a progress message be displayed in the console? Defaults to |
... |
other arguments to be passed to |
type = "h"
will result in plots that resemble barplots. These are not true barplots as the x-axis is not categorical. However if suitable xx
data are provided and lwd
is tweaked correctly for the current graphical device it will result in adequate plots.
Hans Gerritsen
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 | data(effort)
data(coast)
xlim <- c(-12,-5)
ylim <- c(51,54)
col <- terrain.colors(12)
effort$col <- col[match(effort$Month,1:12)]
basemap(xlim, ylim, main = "Monthly trends in haddock landings and fishing effort")
draw.rect(lty=1, col=1)
draw.shape(coast, col="cornsilk")
draw.xy(effort$Lon, effort$Lat, effort$Month, effort$LiveWeight, width=1, height=0.5,
col=effort$col, type="h",lwd=3, border=NA)
draw.xy(effort$Lon, effort$Lat, effort$Month, effort$Effort, width=1, height=0.5, col="red",
type="l", border=NA)
draw.xy(effort$Lon, effort$Lat, effort$Month, effort$Effort, width=1, height=0.5, col="red",
type="p",cex=0.4,pch=16, border=NA)
legend("topleft", c(month.abb,"Effort"), pch=c(rep(22,12),16), pt.bg=c(col,NA),
pt.cex=c(rep(2,12),0.8),col=c(rep(1,12),2), lty=c(rep(NA,12),1), bg="lightblue",
inset=0.02, title="Landings", cex=0.8)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.