plot.sephora {sephora}R Documentation

Plot methods for sephora

Description

Methods associated with sephora-class.

Usage

## S3 method for class 'sephora'
plot(
  x,
  y,
  startYear,
  endYear,
  frequency,
  type = NULL,
  sizeLine = 1,
  sizePoint = 2,
  position_legend = "none",
  title_legend = NULL,
  xLab = "Time",
  yLab = "Index",
  xLim,
  msTitle = "Cluster",
  pointShape = 16,
  pointSize = 2,
  pointStroke = 3,
  textFontface = 2,
  textSize = 5,
  text_hjust = 0.5,
  text_vjust = -0.5,
  ...
)

Arguments

x

a numeric vector or a sephora object.

y

ignored.

startYear

integer, time series initial year.

endYear

integer, time series final year.

frequency

integer giving number of observations per season.

type

character specifying type of plot. By default, NULL; "profiles", "ms" and "derivatives" are also allowed. See Details.

sizeLine

integer giving line size

sizePoint

integer giving point size

position_legend

character. Should a legend be added? Where? See theme.

title_legend

character. Should a legend be added? What would it be? See theme and Details.

xLab

character, label to display in x-axis.

yLab

character, label to display in y-axis. See Details.

xLim

date vector of length 2 indicating limits of x-axis. When no supplied, x will be displayed in the period of time defined by startYear, endYear and frequency.

msTitle

character. Default "Cluster". See Details.

pointShape

shape parameter used in geom_point. Default 16. See Details.

pointSize

size parameter used in geom_point. Default 2. See Details.

pointStroke

stroke parameter used in geom_point. Default 3. See Details.

textFontface

fontface parameter used in geom_text. Default 2. See Details.

textSize

size parameters used in geom_text. Default 5. See Details.

text_hjust

hjust parameter used in geom_text. Default 0.5. See Details.

text_vjust

vjust parameter used in geom_text. Default -0.5. See Details.

...

additional ggplot parameters.

Details

By default, type=NULL and this option allows for plotting numeric vectors and sephora objects; argument title_legend is only pertinent in this case. Other allowed options for type are "profiles", "ms" and "derivatives". When type="profiles" all the arguments used in the default case are allowed except for title_legend. When type="ms", arguments msTitle, pointShape, pointSize, pointStroke, textFontface, textSize, text_hjust and text_vjust are pertinent. When type="derivatives", the default value of argument yLab will be used.

Value

A gg object (or NULL (invisible) when type="derivatives").

Plotting

This function draws either a graphic based on a ggplot or a plot object.

The default is intended for numeric vectors and sephora-class objects. This method employs the ggplot2 system and returns a sort of time series plot.

The method profiles, selected when type="profiles", is also intended for numeric vectors and sephora-class objects. This method is based on the ggplot2 system and draws p curves, one for each period (p=length(startYear:endYear)), on the same time scale (days of the year).

The method ms, selected when type="ms", is intended for sephora-class objects only. Using the ggplot2 system this method draws the result of a multidimensional scaling analysis performed on the smoothed version of the p curves described above.

The method derivative, selected when type="derivatives", is intended for sephora-class objects only. A 5-panel plot is drawn showing (from top to bottom):


[Package sephora version 0.1.31 Index]