Wolfram Language & System 10.4 (2016)|Legacy Documentation

This is documentation for an earlier version of the Wolfram Language.View current documentation (Version 11.2)

DateHistogram

DateHistogram[{date1,date2,}]
plots a histogram of the dates .

DateHistogram[{date1,date2,},bspec]
plots a histogram with bin width specification bspec.

DateHistogram[{date1,date2,},bspec,hspec]
plots a histogram with bin heights computed according to the specification hspec.

DateHistogram[{data1,data2,}]
plots histograms for multiple datasets .

Details and OptionsDetails and Options

  • Possible forms of include:
  • DateObject,TimeObjectdate or time object
    "string"DateString specification
    {y,m,d,h,m,s}DateList specification
    {y},{y,m},{y,m,d},shortened date list
    tabsolute time given as a single number
  • Datasets have the following forms and interpretations:
  • {date1,date2,}list of dates or times
    <|"k1"date1,"k2"date2,|>the values in an association
    TimeSeries,EventSeriesthe times in time series
    w[datai]wrapper applied to a dataset
  • The following wrappers w can be used for datasets :
  • Annotation[datai,label]provide an annotation
    Button[datai,action]define an action to execute when the curve is clicked
    EventHandler[datai,]define a general event handler for the curve
    Hyperlink[datai,uri]make the curve act as a hyperlink
    Legended[datai,]identify the curve in a legend
    PopupWindow[datai,cont]attach a popup window to the curve
    StatusArea[datai,label]display in the status area when the curve is moused over
    Style[datai,opts]show the curve using the specified styles
    Tooltip[datai,label]attach an arbitrary tooltip to the curve
  • The following bin width specifications bspec can be given:
  • nuse n bins
    "Year","Month","Day",bin by date elements
    {Δt}use bins of duration
    {datemin,datemax,Δt}use bins of duration from to
    {{date1,date2,}}use the bins
    Automaticdetermine bin widths automatically
    fbapply fb to get an explicit bin specification
  • The duration can be a quantity with time units.
  • The function fb in DateHistogram[data,fb] is applied to a list of all and should return an explicit bin list .
  • Different forms of histogram can be obtained by giving different bin height specifications hspec in DateHistogram[data,bspec,hspec]. The following forms can be used:
  • "Count"the number of values lying in each bin
    "CumulativeCount"cumulative counts
    "SurvivalCount"survival counts
    "Probability"fraction of values lying in each bin
    "Intensity"count intensity function
    "PDF"probability density function
    "CDF"cumulative distribution function
    "SF"survival function
    "HF"hazard function
    "CHF"cumulative hazard function
    fhheights obtained by applying fh to bins and counts
  • The function fh in DateHistogram[data,bspec,fh] is applied to two arguments: a list of bins and a corresponding list of counts . The function should return a list of heights to be used for each of the .
  • Only that are dates or times are assigned to bins; others are taken to be missing.
  • In DateHistogram[{data1,data2,},], automatic bin locations are determined by combining all the datasets .
  • DateHistogram[{,wi[datai,],},] renders the histogram elements associated with dataset according to the specification defined by the symbolic wrapper .
  • Possible symbolic wrappers are the same as for BarChart and include Style, Labeled, Legended, etc.
  • DateHistogram has the same options as Graphics, with the following additions and changes:
  • AspectRatio1/GoldenRatiooverall ratio of width to height
    AxesTruewhether to draw axes
    BarOriginBottomorigin of histogram bars
    ChartBaseStyleAutomaticoverall style for bars
    ChartElementFunctionAutomatichow to generate raw graphics for bars
    ChartElementsAutomaticgraphics to use in each of the bars
    ChartLabelsNonecategory labels for datasets
    ChartLayoutAutomaticoverall layout to use
    ChartLegendsNonelegends for data elements and datasets
    ChartStyleAutomaticstyle for bars
    ColorFunctionAutomatichow to color bars
    ColorFunctionScalingTruewhether to normalize arguments to ColorFunction
    DateFunctionAutomatichow to convert dates to standard form
    DateReductionNonewhat cyclic period of time to use
    DateTicksFormatAutomaticformat for date tick labels
    LabelingFunctionAutomatichow to label elements
    LegendAppearanceAutomaticoverall appearance of legends
    PerformanceGoal$PerformanceGoalaspects of performance to try to optimize
    PlotTheme$PlotThemeoverall theme for the histogram
    TimeZoneAutomatictime zone to use
  • Possible settings for ChartLayout include and .
  • The arguments supplied to ChartElementFunction are the bin region , the bin values lists, and metadata from each level in a nested list of datasets.
  • A list of built-in settings for ChartElementFunction can be obtained from .
  • The argument supplied to ColorFunction is the height for each bin.
  • Style and other specifications from options and other constructs in DateHistogram are effectively applied in the order ChartStyle, ColorFunction, Style and other wrappers, ChartElements, and ChartElementFunction, with later specifications overriding earlier ones.

ExamplesExamplesopen allclose all

Basic Examples  (5)Basic Examples  (5)

Generate a histogram for a list of dates:

In[2]:=
Click for copyable input
In[3]:=
Click for copyable input
Out[3]=

Specify bin size in days:

In[4]:=
Click for copyable input
Out[4]=

Place the dates in a time series in monthly bins:

In[1]:=
Click for copyable input
Out[1]=

Show multiple datasets:

In[1]:=
Click for copyable input
In[2]:=
Click for copyable input
Out[2]=

Generate a probability histogram for a list of dates:

In[1]:=
Click for copyable input
Out[1]=

Plot values over the period of a year to see seasonal behavior:

In[1]:=
Click for copyable input
In[2]:=
Click for copyable input
Out[2]=
In[3]:=
Click for copyable input
Out[3]=
Introduced in 2015
(10.2)