Description Usage Arguments Details Value Author(s) See Also Examples
Plots histograms of the length frequency data from the hl table of csData objects. Optionally can plot by a grouping variable, and specific factor levels within the grouping variable. The discarded and landed fractions of the catch can be plotted separately or together.
1 |
x |
an object of class csData or csDataVal |
by |
the character name of a grouping variable. |
level |
the level within the grouping variable, the default is "all". |
fraction |
the fraction of the catch to plot. DIS for discards, LAN for landings. The default is to plot both if present |
title |
logical. adds a title to the outer margin |
... |
other arguments, particularly those to |
The possible options for the grouping variable are those within the
amalgamated hl table produced by mergecsData
and include for time: "year", "month" and "quarter";
for space: "area", and "rect";
for technical: "foCatNat","foCatEu5" and "foCatEu6".
Other options include "proj", "trpCode", "commCat" and "sex".
The default is to plot by "spp" so, for a single species data set, this will plot all length frequencies.
For plotting selected levels within the grouping variable the names of those levels can be passed as a vector to level
, e.g just to plot data from the first quarter then set by ="quarter"
and level=1
. Grouping variables that are numeric, such as months and quarters, are specified as numerics e.g.
level=c(1,3)
. Grouping variables that are characters are specified as character strings e.g. level=c("OTB_DEM")
The arguments that can be passed as ...
includes:
col
for setting the colour or the bars;
border
for setting the colour of the borders of the bars;
add=TRUE
for adding to an existing plot;
angle
for setting the angle of shading lines;
density
for setting the density of the shading lines.
The argument freq=FASLE
will plot a density histogram.
If axes=FALSE
no axes will be plotted.
ylim
sets the limits for the y axes (only applicable for frequency plots) and
xlab
and ylab
are for axes labels.
Other graphical parameters include main
, sub
, cex.main
, cex.asis
, cex.lab
e.t.c see hist
and par
for more details.
The outer margin default title is \"Length distribution of species by grouping variable\". This can be turned off if title=FALSE
.
The figure titles default to the argument passed as by
and, if specified, level
. This can be overwritten by a call to main
. main=""
will result in no figure title.
par(mfrow=c(nrow,ncol))
can be used to adjust the number of plots per page to accommodate the multiple figures generated when the grouping variable has more than one level.
A named list of the grouping variable and levels plotted, each component of which
is itself a list of class "histogram" with components breaks, counts, density,
intensities, mids xname and equidist. See hist
for details.
Alastair Pout a.pout@marlab.ac.uk
agelenPlot
which plots lengths against ages.
1 2 3 4 5 6 7 8 9 10 11 12 | #data(cod2004cs)
# Plotting the length distribution in the hl table
#lengthHist(cod2004cs,col=2)
# and now grouped by the commercial category
#lengthHist(cod2004cs,by="commCat",level=1,col=2,density=30,main="")
#for(i in 2:6)lengthHist(cod2004cs,by="commCat",level=i,col=(i+1),density=30,main="",add=TRUE,title=FALSE)
# plotting by quarter
#par(mfrow=c(2,2))
#lengthHist(cod2004cs,by="quarter",col=2,freq=TRUE)
#par(mfrow=c(1,1))
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.