plot the spectra in a colorSpec object as lines or points
# S3 method for colorSpec
plot( x, color=NULL, subset=NULL, main=TRUE, legend=TRUE, CCT=FALSE, add=FALSE, ... )
TRUE
or FALSE
a colorSpec object
If color=NULL
then colors are computed from the spectra themselves.
If type(x)
is 'material'
the color is computed using
illuminant D65.1nm
and responder BT.709.RGB
with no further normalization.
Otherwise the spectrum color is faked by changing its quantity
to 'energy'
and taking the product
with BT.709.RGB
.
The resulting RGBs are normalized to have a maximum of 1.
This RGB normalization is done before processing the subset
argument.
If color='auto'
then a suitable set of colors is generated using
colorRamp()
.
Otherwise color
is passed on to lines.default()
as the col
argument, e.g. col='black'
.
specifies a subset of x
to plot;
see subset()
for acceptable arguments.
If main=TRUE
then a main title is generated from the file 'path'
in
the metadata
list, or from deparse(substitute(x))
.
If main=FALSE
then no main title is displayed.
And if main
is a string then that string is used as the main title.
If legend=TRUE
then a pretty legend using specnames(x)
is placed in the 'topright'
corner of the plot.
If legend
is a string it is interpreted as naming a corner of the
plot and passed as such to the function legend
.
If legend=FALSE
then no legend is drawn.
If CCT=TRUE
and the type
of x
is 'light'
then
the CCT of each spectrum is added to the legend; see computeCCT()
.
If add=TRUE
then the lines are added to an existing plot,
and these arguments are ignored:
main
, ylab
, xlim
, ylim
,
and log
; see Details.
other graphical parameters, see Details
Commonly used graphical parameters are:
type
passed to lines.default()
,
with default type='l'
.
Other valid values are 'p'
(points), 'b'
, 'c'
, 'o'
,
'h'
, 'S'
, 's'
, and 'n'
,
see plot()
for their meanings.
An additional type='step'
is available.
This option draws each spectrum as a step function,
similar to 'S'
and 's'
,
except that the jumps are between the wavelengths
(with appropriate extensions at min and max wavelengths).
The function segments()
is used for the drawing.
For type='step'
, lwd
and lty
should be vectors of length 1 or 2.
If the length of lwd
is 1, then horizontal segments are draw with that width,
but vertical segments are not drawn.
If the length of lwd
is 2,
then vertical segments are draw with width lwd[2]
.
If the length of lty
is 2, then the styles are applied to the
horizontal and vertical segments in that order.
If the length of lty
is 1, then that style is applied to both
horizontal and vertical segments.
For examples of this plotting option, see the vignette
Convexity and Transitions.
lwd, lty
passed to lines.default()
,
except when type='step'
when they are passed to segments()
.
In the former case these can be vectors, and components are passed
sequentially to each spectrum, similar to matplot()
.
In the latter case, see the description in type
.
The default value for both is 1.
pch
passed to lines.default()
,
but it only has meaning when type='p'
, 'b'
, or 'o'
.
This can be a vector, and components are passed sequentially to each spectrum.
ylab
If ylab
is a string
then it is passed on to plot.default()
,
otherwise suitable default string is generated.
xlim, ylim
If xlim
and ylim
are 2-vectors, they are passed
to plot.default
.
If one of the components is NA
then a suitable default is supplied.
log
passed on to plot.default()
.
Care must be taken for y
because
many spectra are 0 at some wavelengths, and even negative. Use ylim
in such cases.
plot( 100 * BT.709.RGB )
plot( xyz1931.1nm, add=TRUE, lty=2, legend=FALSE )
Run the code above in your browser using DataLab