plots a histogram of the dates datei.


plots a histogram with bin width specification bspec.


plots a histogram with bin heights computed according to the specification hspec.


plots histograms for multiple datasets datai.

Details and Options

  • Possible forms of datei 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 datai 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 datai
  • The following wrappers w can be used for datasets datai:
  • 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 Δt
    {datemin,datemax,Δt}use bins of duration Δt from datemin to datemax
    {{date1,date2,}}use the bins [d1,d2),[d2,d3),
    Automaticdetermine bin widths automatically
    fbapply fb to get an explicit bin specification {d1,d2,}
  • The duration Δt can be a quantity with time units.
  • The function fb in DateHistogram[data,fb] is applied to a list of all datei and should return an explicit bin list {d1,d2,}.
  • 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
    {"Log",hspec}log-transformed height specification
    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 {{d1,d2},{d2,d3},} and a corresponding list of counts {c1,c2,}. The function should return a list of heights to be used for each of the ci.
  • Only datei 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 datai.
  • DateHistogram[{,wi[datai,],},] renders the histogram elements associated with dataset datai according to the specification defined by the symbolic wrapper wi.
  • 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 "Overlapped" and "Stacked".
  • The arguments supplied to ChartElementFunction are the bin region {{xmin,xmax},{ymin,ymax}}, the bin values lists, and metadata {m1,m2,} from each level in a nested list of datasets.
  • A list of built-in settings for ChartElementFunction can be obtained from ChartElementData["DateHistogram"].
  • 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.


open all close all

Basic Examples  (5)

Generate a histogram for a list of dates:

Click for copyable input
Click for copyable input

Specify bin size in days:

Click for copyable input

Place the dates in a time series in monthly bins:

Click for copyable input

Show multiple datasets:

Click for copyable input
Click for copyable input

Generate a probability histogram for a list of dates:

Click for copyable input

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

Click for copyable input
Click for copyable input
Click for copyable input

Scope  (19)

Options  (58)

Applications  (4)

Introduced in 2015
Updated in 2017