DateListPlot[{{date1,y1},{date2,y2},…,{daten,yn}}]
在一个日期序列上,绘制值为 yi 的点.
DateListPlot[{y1,y2,…,yn},datespec]
在 datespec 确定的相同间隔的日期上,绘制点.
DateListPlot[tseries]
绘制时间序列 tseries.
DateListPlot[{data1,data2,…}]
从所有 datai 绘制数据.
DateListPlot[{…,w[datai],…}]
绘制 datai 及由符号式封装 w 定义的特征.
DateListPlot
DateListPlot[{{date1,y1},{date2,y2},…,{daten,yn}}]
在一个日期序列上,绘制值为 yi 的点.
DateListPlot[{y1,y2,…,yn},datespec]
在 datespec 确定的相同间隔的日期上,绘制点.
DateListPlot[tseries]
绘制时间序列 tseries.
DateListPlot[{data1,data2,…}]
从所有 datai 绘制数据.
DateListPlot[{…,w[datai],…}]
绘制 datai 及由符号式封装 w 定义的特征.
更多信息和选项
- DateListPlot 亦称为时间序列绘图或按时间顺序绘制的图.
- 规则数据 {y1,…,yn} 绘制成一条通过点 {datei,yi} 的函数曲线,其中 datei 在 datespec 的开始和结束日期之间均匀间隔分布.
- 不规则数据 {{date1,y1},…,{daten,yn}} 绘制为一条通过点 {datei,yi} 的按时间顺序的有序曲线.
- datei 可能的形式包括:
-
DateObject[…],TimeObject[…] 日期或时间对象 "string" DateString 规范 {y,m,d,h,m,s} DateList 规范 {y},{y,m},{y,m,d},… 缩写的日期列表 t 以单个数字给出的绝对时间 - 在缩写的日期列表中,省略的元素将采用缺省值 {y,1,1,0,0,0}.
- datespec 可能的形式包括:
-
{start,end} 日期从 start 到 end 等量增加 {start,Automatic,Δt} 日期从 start 开始按 Δt 增加 {Automatic,end,Δt} 日期到 end 结束按 Δt 增加 start 由 start 的形式决定日期增量 - datespec 中的 Δt 可以是 {y,m,d,h,m,s} 日期列表规范或特殊形式 "Year"、"Quarter"、"Month"、"Week"、"Day"、"Hour"、"Minute"、"Second" 及 "Millisecond" 中的任意一种.
- 如果没有明确指定 Δt,则使用 start 中明确指定的最小时间单位作为增量.
- 数据值 yi 可以下列形式给出:
-
yi 实值 Quantity[yi,unit] 带单位的量 Around[yi,ei] 具有不确定性 ei 的值 yi Interval[{ymin,ymax}] 介于 ymin 和 ymax 之间的值 - 不是前述形式的值 yi 被认为是缺失数据,不会显示.
- datai 具有下列形式和解释:
-
<|"k1"y1,"k2"y2,…|> 值 {y1,y2,…} <|date1y1,date2y2,…|> 键-值对 {{date1,y1},{date2,y2},…} TimeSeries, EventSeries 时间-值对 QuantityArray 数量级 WeightedData 无权重值 - DateListPlot[Tabular[…]cspec] 用列指定 cspec 从表格对象中提取值并绘制.
- 可使用以下形式的列指定 cspec 来绘制表格数据:
-
{colx,coly} 相对于 x 列数据绘制 y 列数据 {{colx1,coly1},{colx2,coly2},…} 相对于 x1 列数据绘制 y1 列数据,y2 相对于 x2, … coly, {coly} 以序列形式绘制 y 列的值 {{coly1},…,{colyi},…} 以序列形式绘制 y1, y2, … 列的值 - colx 也可以是 Automatic,在这种情况下,用 DataRange 生成序列的值.
- DateListPlot[TimeSeries[…]cspec] 和 DateListPlot[EventSeries[…]cspec] 用分量指定 cspec 从时间或事件序列中提取值并绘制.
- 可使用以下形式的分量指定 cspec 来绘制序列数据:
-
com 绘制分量 com 与时间戳 {com1,com2,…} 绘制每个分量 comi 与时间戳 - 以下封装 w 可用于 datai:
-
Annotation[datai,label] 提供数据的注释 Button[datai,action] 定义当点被点击时要执行的操作 Callout[datai,label] 使用呼唤点标注数据 EventHandler[datai,…] 给点定义一般的事件句柄 Highlighted[datai,effect] 动态突出显示 fi 的效果 Highlighted[datai,Placed[effect,pos]] 静态突出显示 fi 位于位置 pos 的效果 Hyperlink[datai,uri] 把点变成超链接 Labeled[datai,label] 给数据添加标签 Legended[datai,label] 在图例中标识数据 PopupWindow[datai,cont] 给点附加弹出式窗口 StatusArea[datai,label] 当鼠标悬停时在状态栏显示 Style[datai,styles] 用指定的样式显示点 Tooltip[datai,label] 给点附加提示条 Tooltip[datai] 使用点的数据值作为提示条内容 - 封装 w 可被用在多个层级:
-
{…,w[yi],…} 封装列表中的值 yi {…,w[{datei,yi}],…} 封装点 {datei,yi} w[datai] 封装数据 datai w[{data1,…}] 封装一组数据 w1[w2[…]] 使用嵌套封装 - 在 DateListPlot 中,Labeled 和 Placed 允许使用下列位置:
-

Above 曲线上方的位置 
Below 曲线下面的位置 
Before 曲线前面的位置 
After 曲线后面的位置 
Start 每条曲线开始的位置 
End 每条曲线结束的位置 
x 靠近曲线的位置 x 处 
Scaled[s] 沿曲线的缩放位置 s 
{s,Above} 沿曲线的位置 s 处,在该处曲线的上面 
{s,Below} 沿曲线的位置 s 处,在该处曲线的下面 
{pos,epos} 曲线的位置 pos 处标签内的 epos 处 - DateListPlot 和 Graphics 有相同的选项,并具有下列增加和改变: [所有选项的列表]
- DataRange 确定了值 {y1,…,yn} 如何解释成 {{date1,y1},…,{xn,yn}}. 可能的设置包括:
-
Automatic,All 均匀地从 1 到 n {xmin,xmax} 均匀地从 xmin 到 xmax - 一般来说,一组数值对 {{x1,y1},{x2,y2},…} 会被解释成一组点,但设置 DataRangeAll 会把它强制解释成多个数据 {{y11,y12},{y21,y23},…}.
- 默认设置 JoinedAutomatic 将大多数形式的数据绘制为连接的曲线,但来自 EventSeries 的数据显示为离散点.
- 在多个绘图面板中显示一条曲线的 PlotLayout 的可能设置包括:
-

"Overlaid" 重叠显示所有数据 
"Stacked" 堆置数据 
"Percentile" 堆置并归一化数据 - 在多个绘图面板中显示一条曲线的 PlotLayout 的可能设置包括:
-
"Column" 在一列面板中分别显示曲线 "Row" 在一行面板中分别显示曲线 {"Column",k},{"Row",k} 采用 k 行或列 {"Column",UpTo[k]},{"Row",UpTo[k]} 最多采用 k 行或列 - PlotLegends 的典型设置包括:
-
None 无图例 Automatic 自动确定图例 {lbl1,lbl2,…} 用 lbl1、lbl2、… 作为图例标签 Placed[lspec,…] 指定图例的位置 - PlotStylesty 指定每条曲线使用的样式. 可能的设置包括:
-
{sty1,sty2,…} 针对每个数据集的一系列样式 <|"key"val,…|> 针对不同层级的数据的样式元素 - 接受的键有:
-
"Base" 所有 datai 的整体样式 "Lists" 针对每个 datai 的样式 styi 的列表 - ColorData["DefaultPlotColors"] 给出 PlotStyle 使用的默认颜色序列.
- ScalingFunctions->"scale" 缩放
坐标;ScalingFunctions{"scalex","scaley"} 同时缩放
和
坐标. - 在 Prolog、Epilog、Ticks 等里面的所有显式
坐标都被认为是日期. - Highlighted 和 PlotHighlighting 的可能突出显示效果包括:
-

style 突出显示指定的数据 
"Ball" 突出显示并标记数据中的指定点 
"Dropline" 突出显示并为数据中的指定点添加标签,并在轴线上标出垂线 
"XSlice" 突出显示并标记沿垂直切面的所有点 
"YSlice" 突出显示并标记沿水平切面的所有点 
Placed[effect,pos] 静态突出显示给定位置 pos - 突出显示位置 pos 的规约包括:
-
x, {x} {x,y} 处的效果,其中 y 为自动选择 {x,y} {x,y} 处的效果 {pos1,pos2,…} 多个位置 posi
所有选项的列表
范例
打开所有单元 关闭所有单元基本范例 (6)
DateListPlot[{{DateObject[{2016, 10, 1}, "Day", "Gregorian", -5.], 10}, {DateObject[{2016, 10, 15}, "Day", "Gregorian", -5.], 17}, {DateObject[{2016, 10, 30}, "Day", "Gregorian", -5.], 15}, {DateObject[{2016, 11, 20}, "Day", "Gregorian", -5.], 20}}]DateListPlot[{1, 1, 2, 3, 5, 8, 11}, DateObject[{2000, 8}, "Month"]]data1 = TimeSeries[{1, 1, 2, 3, 5, 8, 11}, {DateObject[{2015, 1, 1}, "Day"]}];
data2 = TimeSeries[{5, 8, 9, 6, 2, 4, 7}, {DateObject[{2015, 1, 1}, "Day"]}];DateListPlot[{data1, data2}, PlotLegends -> {"first", "second"}]DateListPlot[{{4, 9, 18, 27, 34, 40, 49, 54, 64, 72}, {1, 9, 11, 16, 18, 25, 34, 43, 49, 54}}, DateObject[{2025, 1, 1}, "Day"], PlotLabels -> {"first", "second"}]DateListPlot[TimeSeries[TimeEventSeries`TimestampData[Association["UniformlySpacedQ" -> True, "Count" -> 10,
"Endpoints" -> TabularColumn[Association[
"Data" -> {2, {{NumericArray[{15706, -2147483648}, "Integer32"], {},
DataStructure["BitVe ... 7, 34, 40, 49, 54, 64, 72}, {}, None},
"ElementType" -> "Integer64"]], TabularColumn[Association[
"Data" -> {{1, 9, 11, 16, 18, 25, 34, 43, 49, 54}, {}, None},
"ElementType" -> "Integer64"]]}}]]]], Association[]] -> "a", PlotLabels -> Automatic]DateListPlot[FinancialData["IBM", DateObject[{2024, 1, 1}, "Day"]]]范围 (49)
数据 (11)
data = WeatherData["KCMI", "MeanTemperature", {{2013, 1, 1}, {2013, 1, 31}, "Day"}]DateListPlot[data, FrameLabel -> Automatic, TargetUnits -> "Fahrenheit"]绘制 TimeSeries 或 EventSeries 中的所有数据:
DateListPlot[TimeSeries[TimeEventSeries`TimestampData[Association["UniformlySpacedQ" -> False,
"Timestamps" -> TabularColumn[Association[
"Data" -> {7, {{NumericArray[{-248, 118, 298, 638, 865, 1006, 1216}, "Integer32"], {},
None}}, None}, ... "Data" -> {{32, 62, 112, 167, 179, 209, 214}, {}, None}, "ElementType" -> "Integer64"]],
TabularColumn[Association["Data" -> {{30, 49, 81, 125, 142, 174, 177}, {}, None},
"ElementType" -> "Integer64"]]}}]]]], Association[]]]绘制 TimeSeries 或 EventSeries 的特定分量:
trees = TimeSeries[TimeEventSeries`TimestampData[Association["UniformlySpacedQ" -> False,
"Timestamps" -> TabularColumn[Association[
"Data" -> {7, {{NumericArray[{-248, 118, 298, 638, 865, 1006, 1216}, "Integer32"], {},
None}}, None}, ... "Data" -> {{32, 62, 112, 167, 179, 209, 214}, {}, None}, "ElementType" -> "Integer64"]],
TabularColumn[Association["Data" -> {{30, 49, 81, 125, 142, 174, 177}, {}, None},
"ElementType" -> "Integer64"]]}}]]]], Association[]];DateListPlot[trees -> "tree 1"]DateListPlot[trees -> {"tree 1", "tree 2"}]以 AbsoluteTime 规范给出的日期:
data = {{3368649600, 10}, {3369859200, 12}, {3371155200, 15}, {3372969600, 20}};DateListPlot[data]以 DateString 规范给出的日期:
data = {{"June 2006", 10}, {"August 2006", 12}, {"November 2006", 15}, {"January 2007", 20}};DateListPlot[data]以 DateList 规范给出的日期:
data = {{{2006, 6}, 10}, {{2006, 8}, 12}, {{2006, 11}, 15}, {{2007, 1}, 20}};DateListPlot[data]DateListPlot[Sin[Range[100] / (2Pi)], "August 15, 2006"]DateListPlot[Sin[Range[100] / (2Pi)], {2006, 8, 15, 12, 15, 0}]DateListPlot[Sqrt[Range[10]], {{2006, 5, 5}, {2006, 5, 30}}]绘制从 2006 年 1 月 1 日开始,汇集在每个 90 天时间段的数据集合:
DateListPlot[Range[10], {{2006, 1, 1}, Automatic, {0, 0, 90}}]DateListPlot[Range[10], {{2006, 1, 15}, Automatic, "Month"}]DateListPlot[ArcTan[Range[50] / 5], {Automatic, "September 2010", "Month"}]用 ScalingFunctions 缩放数轴:
DateListPlot[FinancialData["IBM", "Jan. 1, 2010"], ScalingFunctions -> "Log"]特殊数据 (4)
用 Quantity 包含带单位的数据:
DateListPlot[Quantity[Sqrt[Range[10]], "Meters"], {2010, 1, 1}, FrameLabel -> Automatic]绘制 QuantityArray 的数据:
qa = QuantityArray[RandomReal[{0, 40}, 20], "Fahrenheit"]DateListPlot[qa, {2000, 1, 1}, FrameLabel -> Automatic]用 TargetUnits 指定单位:
DateListPlot[qa, {2000, 1, 1}, TargetUnits -> "Kelvin", FrameLabel -> Automatic]Association 中的数字值被用作
轴:
DateListPlot[<|"a" -> 2, "b" -> 3, "c" -> 5, "d" -> 7, "e" -> 11, "f" -> 13|>, "Jan, 1, 2010"]Association 中的数值键和值被用作
轴和
轴:
DateListPlot[<|2 -> 1, 3 -> 2, 5 -> 3, 7 -> 4, 11 -> 5, 13 -> 6|>]DateListPlot[Table[Around[n, RandomReal[1, 2]], {n, 10}], {2010, 1, 1}]DateListPlot[Table[Interval[RandomReal[{n - 1, n + 1}, 2]], {n, 10}], {2010, 1, 1}]DateListPlot[Table[Interval[RandomReal[{n - 1, n + 1}, 2]], {n, 10}], {2010, 1, 1}, IntervalMarkers -> "Bands"]表格数据 (1)
tab = Tabular[IconizedObject[«Country populations»]]DateListPlot[tab -> {"Date", "France"}]DateListPlot[tab -> {{"Date", "France"}, {"Date", "Germany"}, {"Date", "Australia"}}]DateListPlot[tab -> {{"Date", "France"}, {"Date", "Germany"}, {"Date", "Australia"}}, PlotLegends -> {"France", "Germany", "Australia"}]封装 (8)
{DateListPlot[{Style[{1, 1, 2, 3, 5, 8}, Green], {2, 3, 5, 7, 11}}, {2014, 8}], DateListPlot[Style[{{1, 1, 2, 3, 5, 8}, {2, 3, 5, 7, 11}}, Blue], {2014, 8}]}DateListPlot[Style[{Style[{1, 1, 2, 3, 5, 8}, Green], {2, 3, 5, 7, 11}}, Blue], {2014, 8}]DateListPlot[Tooltip[Prime[Range[10]]], {2014, 8}, Mesh -> Full]DateListPlot[Tooltip[Prime[Range[10]], "primes"], {2014, 8}, Mesh -> Full]利用 PopupWindow 提供更多额外信息:
DateListPlot[{1, PopupWindow[2, DateListPlot[FinancialData["IBM", "Jan. 1, 2004"]]], 3}, {2004, 1}, Mesh -> Full, PlotStyle -> PointSize[0.05]]可以利用 Button 来触发任意操作:
DateListPlot[{1, Button[2, Speak[2]], 3}, {2014, 8}, Mesh -> Full, PlotStyle -> PointSize[0.05]]将 Annotation 用于当鼠标进入绘图区时的动态操作:
data = TemporalData[TimeSeries, {{{7, 12, 15, 20}}, {{{3368649600, 3369859200, 3371155200, 3372969600}}},
1, {"Continuous", 1}, {"Discrete", 1}, 1, {ValueDimensions -> 1, DateFunction -> Automatic,
ResamplingMethod -> {"Interpolation", InterpolationOrder -> 1}}}, True, 10.2];{DateListPlot[Annotation[data, "label", "Mouse"]], Dynamic[MouseAnnotation[]]}当点击曲线时,利用 Hyperlink 跳到指定的链接:
data = TemporalData[TimeSeries, {{{7, 12, 15, 20}}, {{{3368649600, 3369859200, 3371155200, 3372969600}}},
1, {"Continuous", 1}, {"Discrete", 1}, 1, {ValueDimensions -> 1, DateFunction -> Automatic,
ResamplingMethod -> {"Interpolation", InterpolationOrder -> 1}}}, True, 10.2];DateListPlot[Hyperlink[data, "http://www.wolfram.com"]]利用 StatusArea 在当前笔记本的状态区显示一个字符串:
data = TemporalData[TimeSeries, {{{7, 12, 15, 20}}, {{{3368649600, 3369859200, 3371155200, 3372969600}}},
1, {"Continuous", 1}, {"Discrete", 1}, 1, {ValueDimensions -> 1, DateFunction -> Automatic,
ResamplingMethod -> {"Interpolation", InterpolationOrder -> 1}}}, True, 10.2];DateListPlot[StatusArea[data, "String"]]标签和图例 (16)
用 Labeled 给数据添加标签:
data1 = Accumulate@RandomInteger[10, 10];data2 = Accumulate@RandomInteger[3, 10];DateListPlot[{Labeled[data1, "company1"], Labeled[data2, "company2"]}, {2010, 1, 1}]DateListPlot[Table[Labeled[RandomReal[], i], {i, 15}], {2010, 1, 1}, PlotMarkers -> Automatic]Table[DateListPlot[Table[Labeled[RandomReal[], i, p], {i, 6}], {2010, 1, 1}, PlotMarkers -> Automatic, PlotLabel -> p], {p, {Above, Below, Before, After}}]用 PlotLabels 给数据添加标签:
data1 = Accumulate@RandomInteger[10, 10];data2 = Accumulate@RandomInteger[3, 10];DateListPlot[{data1, data2}, {2000}, PlotLabels -> {"company1", "company2"}]DateListPlot[Labeled[Accumulate@RandomInteger[10, 10], "label", {2004}], {2000}]DateListPlot[Labeled[Accumulate@RandomInteger[10, 10], "label", Scaled[0.3]], {2000}]DateListPlot[Labeled[Accumulate@RandomInteger[10, 10], "label", {Scaled[0.3], Below}], {2000}]data1 = Accumulate@RandomInteger[10, 20];data2 = Accumulate@RandomInteger[3, 20];DateListPlot[{data1, data2}, {2000}, PlotLegends -> {"company1", "company2"}]data1 = Accumulate@RandomInteger[10, 20];data2 = Accumulate@RandomInteger[3, 20];DateListPlot[{Callout[data1, "company1"], Callout[data2, "company2"]}, {2000, 8}]DateListPlot[{{1, 1, 2, 3, 5, 8, 11}, Callout[{4, 7, 8, 5, 3, 4, 1}, "max", Above]}, {2000, 8}]DateListPlot[Callout[{1, 1, 2, 3, 5, 8, 11}, "label", DateObject[{2000, 10, 1}, "Day", "Gregorian", -6.]], {2000, 8}]data = Rule[TimeSeries[{1, 1, 2, 3, 5, 8, 11}, {"Jan 1, 2015"}], RandomWord[7]];DateListPlot[data, LabelingSize -> 30]DateListPlot[data, LabelingSize -> Full]用 Legended 给指定数据集提供图例:
data1 = Accumulate@RandomInteger[10, 20];data2 = Accumulate@RandomInteger[3, 20];DateListPlot[{data1, data2, Legended[data1 - data2, "difference"]}, {200}]用 Placed 改变图例位置:
DateListPlot[{data1, data2, Legended[data1 - data2, Placed["difference", Bottom]]}, {200}]用 Association 的键作为标签:
data1 = Accumulate@RandomInteger[10, 20];data2 = Accumulate@RandomInteger[3, 20];DateListPlot[<|"company A" -> data1, "company B" -> data2|>, {2000}, PlotLabels -> Automatic, PlotLegends -> None]当你把鼠标移到绘图上方时,绘图通常会有交互式 callout 显示坐标:
DateListPlot[Range[10], {2007}]DateListPlot[Callout[Range[10], "hello", "01/01/2012"], {2007}]{DateListPlot[Range[10], {2007}, PlotHighlighting -> "Dropline"], DateListPlot[Range[10], {2007}, PlotHighlighting -> "XSlice"]}用 Highlighted 强调图中特定的点:
DateListPlot[Highlighted[Range[10], Placed["Ball", DateObject[{2011, 1, 1}]]], {2007}]用 Highlighted[…,None] 禁止对一组点进行突出显示:
DateListPlot[{Range[10], Highlighted[2 * Range[10], None]}, {2007}]外观 (9)
data = {TemporalData[TimeSeries, {{{0.001728865808273472, -0.01590632147490456, -0.0018485884757761806,
0.006648303196752581, -0.008821574894342765, -0.011374996477267585, 0.014105518254347471,
-0.005791611372873207, -0.016712024386437596, 0.0442 ... ,
3473452800, 3473539200, 3473625600, 3473712000, 3473971200}}}, 1, {"Continuous", 1},
{"Discrete", 1}, 1, {ValueDimensions -> 1, DateFunction -> Automatic,
ResamplingMethod -> {"Interpolation", InterpolationOrder -> 1}}}, True, 10.4], TemporalData[TimeSeries, {{{-0.012079959639636706, -0.00649603754683159, -0.0034615116740605023,
0.010034759075811639, -0.010470083438789857, 0.007954880980081347, -0.0021454152647096825,
0.015971751173178284, -0.004005729627509891, 0.017 ... ,
3473452800, 3473539200, 3473625600, 3473712000, 3473971200}}}, 1, {"Continuous", 1},
{"Discrete", 1}, 1, {ValueDimensions -> 1, DateFunction -> Automatic,
ResamplingMethod -> {"Interpolation", InterpolationOrder -> 1}}}, True, 10.4]};DateListPlot[data]data = {TemporalData[TimeSeries, {{{0.001728865808273472, -0.01590632147490456, -0.0018485884757761806,
0.006648303196752581, -0.008821574894342765, -0.011374996477267585, 0.014105518254347471,
-0.005791611372873207, -0.016712024386437596, 0.0442 ... ,
3473452800, 3473539200, 3473625600, 3473712000, 3473971200}}}, 1, {"Continuous", 1},
{"Discrete", 1}, 1, {ValueDimensions -> 1, DateFunction -> Automatic,
ResamplingMethod -> {"Interpolation", InterpolationOrder -> 1}}}, True, 10.4], TemporalData[TimeSeries, {{{-0.012079959639636706, -0.00649603754683159, -0.0034615116740605023,
0.010034759075811639, -0.010470083438789857, 0.007954880980081347, -0.0021454152647096825,
0.015971751173178284, -0.004005729627509891, 0.017 ... ,
3473452800, 3473539200, 3473625600, 3473712000, 3473971200}}}, 1, {"Continuous", 1},
{"Discrete", 1}, 1, {ValueDimensions -> 1, DateFunction -> Automatic,
ResamplingMethod -> {"Interpolation", InterpolationOrder -> 1}}}, True, 10.4]};DateListPlot[data, PlotStyle -> {Dashed, Red}]DateListPlot[{FinancialData["AAPL", "FractionalChange", {{2010, 1}, {2010, 2}}], FinancialData["IBM", "FractionalChange", {{2010, 1}, {2010, 2}}]}, PlotLegends -> {"AAPL", "IBM"}]使用 Legended 提供特定数据集的图例:
data = Accumulate[RandomInteger[{-10, 10}, 100]];
avg = MovingAverage[data, 10];DateListPlot[{data, Legended[avg, "moving average"]}, {{2013, 1, 1}, Automatic, "Day"}, Joined -> True]data = {FinancialData["BAC", "FractionalChange", {{2014, 1}, {2014, 4}}], FinancialData["WFC", "FractionalChange", {{2014, 1}, {2014, 4}}]};DateListPlot[data, PlotTheme -> "Detailed"]DateListPlot[data, PlotTheme -> "Marketing"]data = {TemporalData[TimeSeries, {{{0.001728865808273472, -0.01590632147490456, -0.0018485884757761806,
0.006648303196752581, -0.008821574894342765, -0.011374996477267585, 0.014105518254347471,
-0.005791611372873207, -0.016712024386437596, 0.0442 ... ,
3473452800, 3473539200, 3473625600, 3473712000, 3473971200}}}, 1, {"Continuous", 1},
{"Discrete", 1}, 1, {ValueDimensions -> 1, DateFunction -> Automatic,
ResamplingMethod -> {"Interpolation", InterpolationOrder -> 1}}}, True, 10.4], TemporalData[TimeSeries, {{{-0.012079959639636706, -0.00649603754683159, -0.0034615116740605023,
0.010034759075811639, -0.010470083438789857, 0.007954880980081347, -0.0021454152647096825,
0.015971751173178284, -0.004005729627509891, 0.017 ... ,
3473452800, 3473539200, 3473625600, 3473712000, 3473971200}}}, 1, {"Continuous", 1},
{"Discrete", 1}, 1, {ValueDimensions -> 1, DateFunction -> Automatic,
ResamplingMethod -> {"Interpolation", InterpolationOrder -> 1}}}, True, 10.4]};DateListPlot[data, Filling -> Axis]DateListPlot[data, Filling -> {1 -> {2}}]data = {TemporalData[TimeSeries, {{{0.001728865808273472, -0.01590632147490456, -0.0018485884757761806,
0.006648303196752581, -0.008821574894342765, -0.011374996477267585, 0.014105518254347471,
-0.005791611372873207, -0.016712024386437596, 0.0442 ... ,
3473452800, 3473539200, 3473625600, 3473712000, 3473971200}}}, 1, {"Continuous", 1},
{"Discrete", 1}, 1, {ValueDimensions -> 1, DateFunction -> Automatic,
ResamplingMethod -> {"Interpolation", InterpolationOrder -> 1}}}, True, 10.4], TemporalData[TimeSeries, {{{-0.012079959639636706, -0.00649603754683159, -0.0034615116740605023,
0.010034759075811639, -0.010470083438789857, 0.007954880980081347, -0.0021454152647096825,
0.015971751173178284, -0.004005729627509891, 0.017 ... ,
3473452800, 3473539200, 3473625600, 3473712000, 3473971200}}}, 1, {"Continuous", 1},
{"Discrete", 1}, 1, {ValueDimensions -> 1, DateFunction -> Automatic,
ResamplingMethod -> {"Interpolation", InterpolationOrder -> 1}}}, True, 10.4]};DateListPlot[data, Mesh -> Full, PlotMarkers -> Automatic]data1 = {{DateObject[{2016, 10, 1}, "Day", "Gregorian", -5.], 10}, {DateObject[{2016, 10, 15}, "Day", "Gregorian", -5.], 17}, {DateObject[{2016, 10, 30}, "Day", "Gregorian", -5.], 15}, {DateObject[{2016, 11, 20}, "Day", "Gregorian", -5.], 20}};data2 = {{DateObject[{2016, 10, 1}, "Day", "Gregorian", -5.], 15}, {DateObject[{2016, 10, 15}, "Day", "Gregorian", -5.], 7}, {DateObject[{2016, 10, 30}, "Day", "Gregorian", -5.], 12}, {DateObject[{2016, 11, 20}, "Day", "Gregorian", -5.], 10}};DateListPlot[{data1, data2}, PlotLayout -> "Stacked"]DateListPlot[{data1, data2}, PlotLayout -> "Percentile"]DateListPlot[{IconizedObject[«Chicago»], IconizedObject[«Miami»]}, PlotLayout -> "Row"]DateListPlot[{IconizedObject[«Chicago»], IconizedObject[«Miami»]}, PlotLayout -> "Column"]DateListPlot[{IconizedObject[«Chicago»], IconizedObject[«Miami»], IconizedObject[«Phoenix»], IconizedObject[«Boston»]}, PlotLayout -> {"Row", 2}, PlotLabels -> {Entity["City", {"Chicago", "Illinois", "UnitedStates"}], Entity["City", {"Miami", "Florida", "UnitedStates"}], Entity["City", {"Phoenix", "Arizona", "UnitedStates"}], Entity["City", {"Boston", "Massachusetts", "UnitedStates"}]}]选项 (134)
AspectRatio (3)
默认情况下, DateListPlot 对绘图使用固定的高宽比:
data = FinancialData["TWLO", {2016, 1, 1}];DateListPlot[data]设置 AspectRatio1 可使高度与宽度相同:
data = FinancialData["TWLO", {2016, 1, 1}];DateListPlot[data, AspectRatio -> 1]AspectRatioFull 调整高度和宽度以便可以恰当地放在其他结构的里面:
data = FinancialData["TWLO", {2016, 1, 1}];plot = DateListPlot[data, AspectRatio -> Full];{Framed[Pane[plot, {50, 100}]], Framed[Pane[plot, {100, 100}]], Framed[Pane[plot, {100, 50}]]}Axes (1)
默认情况下,DateListPlot 使用边框,而不是坐标轴:
data = FinancialData["TWLO", {2016, 1, 1}];DateListPlot[data, Filling -> Bottom]DateListPlot[data, Filling -> Bottom, Frame -> False, Axes -> True]{DateListPlot[data, Joined -> True, Filling -> Bottom, Frame -> False, Axes -> {True, False}], DateListPlot[data, Joined -> True, Filling -> Bottom, Frame -> False, Axes -> {False, True}]}AxesLabel (4)
DateListPlot[FinancialData["TWLO", {2016, 1, 1}], Frame -> False, Axes -> True]DateListPlot[FinancialData["TWLO", {2016, 1, 1}], Frame -> False, Axes -> True, AxesLabel -> "Price"]DateListPlot[FinancialData["TWLO", {2016, 1, 1}], Frame -> False, Axes -> True, AxesLabel -> {"Year", "Price"}]DateListPlot[FinancialData["TWLO", {2016, 1, 1}], Frame -> False, Axes -> True, AxesLabel -> Automatic]AxesOrigin (2)
DateListPlot[FinancialData["TWLO", {2016, 1, 1}], {2007}, Axes -> True, Frame -> False]{DateListPlot[FinancialData["TWLO", {2016, 1, 1}], {2007}, Axes -> True, Frame -> False, AxesOrigin -> {"July 1, 2019", 0}], DateListPlot[FinancialData["TWLO", {2016, 1, 1}], {2007}, Axes -> True, Frame -> False, AxesOrigin -> {"July 1, 2021", 0}]}AxesStyle (1)
data = FinancialData["TWLO", {2016, 1, 1}];DateListPlot[data, Filling -> Bottom, Frame -> False, Axes -> True, AxesStyle -> Red]DateListPlot[data, Filling -> Bottom, Frame -> False, Axes -> True, AxesStyle -> {{Thick, Red}, {Thick, Blue}}]DateListPlot[data, Filling -> Bottom, Frame -> False, Axes -> True, AxesStyle -> Green, TicksStyle -> StandardGray]DateListPlot[data, Filling -> Bottom, Frame -> False, Axes -> True, AxesStyle -> Green, LabelStyle -> StandardGray]DateFunction (2)
data = {{{10, 1}, 8}, {{10, 10}, 10}, {{10, 20}, 12}, {{10, 24}, 14}, {{11, 5}, 15}, {{11, 15}, 20}};DateListPlot[data, DateFunction :> (Join[{2006}, #]&)]data = {{"06/01/06", 8}, {"07/01/06", 10}, {"08/01/06", 12}, {"09/01/06", 14}, {"10/01/06", 15}, {"11/01/06", 20}};DateListPlot[data, DateFunction :> (DateList[{#, {"Month", "Day", "YearShort"}}]&)]DateListPlot[data, DateFunction :> (DateList[{#, {"Day", "Month", "YearShort"}}]&)]DateListPlot[data, DateFunction :> (DateList[{#, {"YearShort", "Month", "Day"}}]&)]DateTicksFormat (1)
按照 DateString 元素指明日期刻度的形式:
data = {{{2006, 10, 1}, 8}, {{2006, 10, 10}, 10}, {{2006, 10, 20}, 12}, {{2006, 10, 24}, 14}, {{2006, 11, 5}, 15}, {{2006, 11, 15}, 20}};DateListPlot[data, DateTicksFormat -> {"MonthShort", "/", "Day"}]Epilog (1)
用缩写的 DateList 作为
坐标来放置文本:
DateListPlot[Range[10], {2007}, Epilog :> Text["linear trend", {{2010, 1, 15}, 6}]]Filling (1)
Frame (4)
默认情况下,DateListPlot 显示边框:
DateListPlot[Range[10], {2007}]DateListPlot[Range[10], {2007}, Frame -> False]DateListPlot[Range[10], {2007}, Frame -> {{True, True}, {False, False}}]DateListPlot[Range[10], {2007}, Frame -> {{True, False}, {True, False}}]FrameLabel (4)
DateListPlot[Range[10], {2007}, FrameLabel -> {"label"}]DateListPlot[Range[10], {2007}, FrameLabel -> {"Bottom", "Left"}]DateListPlot[Range[10], {2007}, FrameLabel -> {{"left", "right"}, {"bottom", "top"}}]DateListPlot[Range[10], {2007}, FrameLabel -> {{"left", "right"}, {"bottom", "top"}}, LabelStyle -> Directive[Bold, StandardPurple]]FrameStyle (2)
FrameTicks (10)
DateListPlot[Range[10], {2007}]DateListPlot[Range[10], {2007}, FrameTicks -> None]DateListPlot[Sqrt[Range[10]], {2007, 4, 10}, FrameTicks -> {{Automatic, Automatic}, {{"April 12, 2007", "April 18, 2007"}, Automatic}}]DateListPlot[Sqrt[Range[10]], {2007, 4, 10}, FrameTicks -> {{Automatic, Automatic}, {{3385324800, 3385843200}, Automatic}}]DateListPlot[Range[10], {2007}, FrameTicks -> {{None, None}, {Automatic, None}}]DateListPlot[Range[10], {2007}, FrameTicks -> Automatic]用 All 在所有边框处显示刻度的标签:
DateListPlot[Range[10], {2007}, FrameTicks -> All]DateListPlot[Range[10], {2007}, FrameTicks -> {{{2, .5, 10}, None}, {{"July 1, 2011", "July 1, 2014"}, None}}]DateListPlot[Range[10], {2007}, FrameTicks -> {{{{2, "two"}, {5, "five"}, {10, "ten"}}, None}, {{{"July 1, 2011", "date 1"}, {"July 1, 2014", "date 2"}}, None}}]DateListPlot[Range[10], {2007}, FrameTicks -> {{{{2, "two", .15}, {5, "five", .45}, {10, "ten", .95}}, None}, {Automatic, None}}]DateListPlot[Range[10], {2007}, FrameTicks -> {{{{2, "two", {.15, .1}}, {5, "five", {.45, .2}}, {10, "ten", {.95, .3}}}, None}, {Automatic, None}}]DateListPlot[Range[10], {2007}, FrameTicks -> {{{{2, "two", .15, Directive[Blue, Thick]}, {5, "five", .45, Directive[Red, Thick, Dashed]}, {10, "ten", .95, Directive[Green, Thick, Dashed]}}, None}, {Automatic, None}}]minMeanMax[min_, max_] := {{min, min}, {(max + min) / 2, (max + min) / 2}, {max, max}}DateListPlot[Range[10], {2007}, FrameTicks -> {{minMeanMax, None}, {Automatic, None}}, PlotRangePadding -> None]FrameTicksStyle (3)
DateListPlot[Range[10], {2007}, FrameStyle -> Directive[Red]]DateListPlot[Range[10], {2007}, FrameStyle -> Directive[Red], FrameTicksStyle -> Directive[Blue, Thick]]DateListPlot[Range[10], {2007}, FrameTicks -> All, FrameTicksStyle -> {{Directive[Orange, Thick], Blue}, {Red, Green}}]GridLines (1)
DateListPlot[Sqrt[Range[15]], {2007, 4, 10}, GridLines -> {{{2007, 4, 15}, "Apr 22, 2007"}, None}]让第一条网格线变成蓝色 Blue:
DateListPlot[Sqrt[Range[15]], {2007, 4, 10}, GridLines -> {{{{2007, 4, 15}, Blue}, "Apr 22, 2007"}, None}]ImageSize (7)
使用已命名尺寸,如 Tiny、Small、Medium 和 Large:
data = FinancialData["TWLO", {2016, 1, 1}];{DateListPlot[data, ImageSize -> Tiny], DateListPlot[data, ImageSize -> Small]}data = FinancialData["TWLO", {2016, 1, 1}];{DateListPlot[data, ImageSize -> 150], DateListPlot[data, AspectRatio -> 1.5, ImageSize -> 150]}{DateListPlot[data, ImageSize -> {Automatic, 150}], DateListPlot[data, AspectRatio -> 2, ImageSize -> {Automatic, 150}]}data = FinancialData["TWLO", {2016, 1, 1}];{DateListPlot[data, ImageSize -> UpTo[200]], DateListPlot[data, AspectRatio -> 2, ImageSize -> UpTo[200]]}data = FinancialData["TWLO", {2016, 1, 1}];DateListPlot[data, ImageSize -> {200, 200}, Background -> Gray]设置 AspectRatioFull 将填充可用空间:
DateListPlot[data, AspectRatio -> Full, ImageSize -> {200, 200}, Background -> StandardGray]data = FinancialData["TWLO", {2016, 1, 1}];{DateListPlot[data, ImageSize -> {UpTo[150], UpTo[100]}], DateListPlot[data, AspectRatio -> 2, ImageSize -> {UpTo[150], UpTo[100]}]}data = FinancialData["TWLO", {2016, 1, 1}];Framed[Pane[DateListPlot[data, ImageSize -> Full, Background -> StandardGray], {200, 100}]]data = FinancialData["TWLO", {2016, 1, 1}];Framed[Pane[DateListPlot[data, ImageSize -> {Scaled[0.5], Scaled[0.5]}, Background -> StandardGray], {200, 100}]]IntervalMarkers (3)
DateListPlot[Table[Around[RandomReal[], 0.1], 10], Today]DateListPlot[Table[Around[RandomReal[], 0.1], 10], Today, IntervalMarkers -> "Bars"]DateListPlot[Table[Around[RandomReal[], .1], 10], Today, IntervalMarkers -> "Bands"]IntervalMarkersStyle (2)
DateListPlot[{Table[Around[RandomReal[20], 1], 10], Table[Around[RandomReal[20], 1], 10]}, Today, PlotStyle -> {Red, Blue}]DateListPlot[{Table[Around[RandomReal[20], 1], 10], Table[Around[RandomReal[20], 1], 10]}, Today, IntervalMarkersStyle -> Gray]Joined (4)
DateListPlot[Sin[Range[100] / Pi], {2006, 1, 1}, Joined -> True]data1 = {{{2006, 10, 1, 0, 0, 0}, 10}, {{2006, 10, 15, 0, 0, 0}, 12}, {{2006, 10, 30, 0, 0, 0}, 15}, {{2006, 11, 20, 0, 0, 0}, 20}};data2 = {{{2006, 10, 5, 0, 0, 0}, 15}, {{2006, 10, 20, 0, 0, 0}, 8}, {{2006, 11, 10, 0, 0, 0}, 5}, {{2006, 11, 15, 0, 0, 0}, 1}};DateListPlot[{data1, data2}, Joined -> True]DateListPlot[{data1, data2}, Joined -> {True, False}]TimeSeries 显示为连续线:
DateListPlot[TimeSeries[TimeEventSeries`TimestampData[Association["UniformlySpacedQ" -> False,
"Timestamps" -> TabularColumn[Association[
"Data" -> {12, {{NumericArray[{20089, 20120, 20148, 20179, 20209, 20240, 20270, 20301, 20332,
20362, ... 146, 166}, {}, None}, "ElementType" -> "Integer64"]],
TabularColumn[Association["Data" -> {{204, 188, 235, 227, 234, 264, 302, 293, 259, 229,
203, 229}, {}, None}, "ElementType" -> "Integer64"]]}}]]]], Association[]]]EventSeries 显示为离散点:
DateListPlot[EventSeries[TimeEventSeries`TimestampData[Association["UniformlySpacedQ" -> False,
"Timestamps" -> TabularColumn[Association[
"Data" -> {12, {{NumericArray[{20089, 20120, 20148, 20179, 20209, 20240, 20270, 20301, 20332,
20362, ... 146, 166}, {}, None}, "ElementType" -> "Integer64"]],
TabularColumn[Association["Data" -> {{204, 188, 235, 227, 234, 264, 302, 293, 259, 229,
203, 229}, {}, None}, "ElementType" -> "Integer64"]]}}]]]], Association[]]]LabelingFunction (3)
DateListPlot[{1, 1, 2, 3, 5, 8} -> {"a", "b", "c", "d", "e", "f"}, {2000}]使用 LabelingFunction->None 压缩标签:
DateListPlot[{1, 1, 2, 3, 5, 8} -> {"a", "b", "c", "d", "e", "f"}, {2000}, LabelingFunction -> None]DateListPlot[{1, 1, 2, 3, 5, 8} -> {"a", "b", "c", "d", "e", "f"}, {2000}, LabelingFunction -> (Placed[Last@#1, Above] &)]DateListPlot[{1, 1, 2, 3, 5, 8} -> {"a", "b", "c", "d", "e", "f"}, {2000}, LabelingFunction -> (Placed[Last@#1, Tooltip] &), PlotMarkers -> Automatic]LabelingSize (4)
DateListPlot[TimeSeries[{1, 1, 2, 3, 5, 8}, {"Jan 1, 2015"}] -> {"healthfulness", "obstreperous", "spectrogram", "vestige", "coinage", "limey"}, ImageSize -> Medium]DateListPlot[TimeSeries[{1, 1, 2, 3, 5, 8}, {"Jan 1, 2015"}] -> {[image], [image], [image], [image], [image], [image]}, ImageSize -> Medium]DateListPlot[TimeSeries[{1, 1, 2, 3, 5, 8}, {"Jan 1, 2015"}] -> {"healthfulness", "obstreperous", "spectrogram", "vestige", "coinage", "limey"}, ImageSize -> Medium, LabelingSize -> 30]DateListPlot[TimeSeries[{1, 1, 2, 3, 5, 8}, {"Jan 1, 2015"}] -> {[image], [image], [image], [image], [image], [image]}, ImageSize -> Medium, LabelingSize -> 20]DateListPlot[TimeSeries[{1, 1, 2, 3, 5, 8}, {"Jan 1, 2015"}] -> {[image], [image], [image], [image], [image], [image]}, ImageSize -> Medium, LabelingSize -> Full]LabelingTarget (6)
DateListPlot[IconizedObject[«data»], Today]DateListPlot[IconizedObject[«data»], Today, LabelingTarget -> All]DateListPlot[IconizedObject[«data»], Today, LabelingTarget -> "Dense"]DateListPlot[IconizedObject[«data»], Today, LabelingTarget -> 0.5]DateListPlot[IconizedObject[«data»], Today, LabelingTarget -> <|"AllowedLabelingPositions" -> "Sides"|>]DateListPlot[IconizedObject[«data»], Today, LabelingTarget -> <|"AllowedLabelingPositions" -> "Corners"|>]DateListPlot[IconizedObject[«data»], Today, LabelingTarget -> <|"AllowLabelClipping" -> True|>]PlotFit (4)
DateListPlot[TimeSeries[TimeEventSeries`TimestampData[Association["UniformlySpacedQ" -> False,
"Timestamps" -> TabularColumn[Association[
"Data" -> {252, {{{1704153600000, 1704240000000, 1704326400000, 1704412800000, 1704672000000,
1704758 ... 22,
139.6699981689453, 140.22000122070312, 139.92999267578125, 137.00999450683594,
137.49000549316406, 134.2899932861328}, {}, None}}, None},
"ElementType" -> TypeSpecifier["Quantity"]["Real64", "USDollars"]]], Association[]], PlotFit -> Automatic]DateListPlot[TimeSeries[TimeEventSeries`TimestampData[Association["UniformlySpacedQ" -> False,
"Timestamps" -> TabularColumn[Association[
"Data" -> {252, {{{1704153600000, 1704240000000, 1704326400000, 1704412800000, 1704672000000,
1704758 ... 22,
139.6699981689453, 140.22000122070312, 139.92999267578125, 137.00999450683594,
137.49000549316406, 134.2899932861328}, {}, None}}, None},
"ElementType" -> TypeSpecifier["Quantity"]["Real64", "USDollars"]]], Association[]], PlotFit -> "Linear"]DateListPlot[TimeSeries[TimeEventSeries`TimestampData[Association["UniformlySpacedQ" -> False,
"Timestamps" -> TabularColumn[Association[
"Data" -> {252, {{{1704153600000, 1704240000000, 1704326400000, 1704412800000, 1704672000000,
1704758 ... 22,
139.6699981689453, 140.22000122070312, 139.92999267578125, 137.00999450683594,
137.49000549316406, 134.2899932861328}, {}, None}}, None},
"ElementType" -> TypeSpecifier["Quantity"]["Real64", "USDollars"]]], Association[]], PlotFit -> "Quadratic"]DateListPlot[TimeSeries[TimeEventSeries`TimestampData[Association["UniformlySpacedQ" -> False,
"Timestamps" -> TabularColumn[Association[
"Data" -> {252, {{{1704153600000, 1704240000000, 1704326400000, 1704412800000, 1704672000000,
1704758 ... 22,
139.6699981689453, 140.22000122070312, 139.92999267578125, 137.00999450683594,
137.49000549316406, 134.2899932861328}, {}, None}}, None},
"ElementType" -> TypeSpecifier["Quantity"]["Real64", "USDollars"]]], Association[]], PlotFit -> PeriodicModel[3]]//QuietPlotFitElements (2)
DateListPlot[TimeSeries[TimeEventSeries`TimestampData[Association["UniformlySpacedQ" -> False,
"Timestamps" -> TabularColumn[Association[
"Data" -> {61, {{NumericArray[{19724, 19725, 19726, 19727, 19730, 19731, 19732, 19733, 19734,
19738, ... 94.28900146484375, 95.00199890136719, 92.56099700927734, 90.25, 90.35600280761719}, {},
None}}, None}, "ElementType" -> TypeSpecifier["Quantity"]["Real64", "USDollars"]]],
Association["ResamplingMethod" -> "LinearInterpolation"]], PlotFit -> Automatic, PlotFitElements -> "BandCurves"]DateListPlot[TimeSeries[TimeEventSeries`TimestampData[Association["UniformlySpacedQ" -> False,
"Timestamps" -> TabularColumn[Association[
"Data" -> {61, {{NumericArray[{19724, 19725, 19726, 19727, 19730, 19731, 19732, 19733, 19734,
19738, ... 94.28900146484375, 95.00199890136719, 92.56099700927734, 90.25, 90.35600280761719}, {},
None}}, None}, "ElementType" -> TypeSpecifier["Quantity"]["Real64", "USDollars"]]],
Association["ResamplingMethod" -> "LinearInterpolation"]], PlotFit -> Automatic, PlotFitElements -> {"BandCurves", <|"ConfidenceLevel" -> 0.5|>}]DateListPlot[TimeSeries[TimeEventSeries`TimestampData[Association["UniformlySpacedQ" -> False,
"Timestamps" -> TabularColumn[Association[
"Data" -> {61, {{NumericArray[{19724, 19725, 19726, 19727, 19730, 19731, 19732, 19733, 19734,
19738, ... 94.28900146484375, 95.00199890136719, 92.56099700927734, 90.25, 90.35600280761719}, {},
None}}, None}, "ElementType" -> TypeSpecifier["Quantity"]["Real64", "USDollars"]]],
Association["ResamplingMethod" -> "LinearInterpolation"]], PlotFit -> Automatic, PlotFitElements -> "Residuals"]DateListPlot[TimeSeries[TimeEventSeries`TimestampData[Association["UniformlySpacedQ" -> False,
"Timestamps" -> TabularColumn[Association[
"Data" -> {61, {{NumericArray[{19724, 19725, 19726, 19727, 19730, 19731, 19732, 19733, 19734,
19738, ... 94.28900146484375, 95.00199890136719, 92.56099700927734, 90.25, 90.35600280761719}, {},
None}}, None}, "ElementType" -> TypeSpecifier["Quantity"]["Real64", "USDollars"]]],
Association["ResamplingMethod" -> "LinearInterpolation"]], PlotFit -> Automatic, PlotFitElements -> {"DataPoints", {"Residuals", <|"Style" -> Opacity[1, StandardRed]|>}}]PlotHighlighting (9)
默认设置 PlotHighlightingAutomatic,则绘图中有交互式坐标 callout:
DateListPlot[Range[10], {2007}]使用 PlotHighlightingNone 可禁用整个绘图的突出显示:
DateListPlot[Range[10], {2007}, PlotHighlighting -> None]DateListPlot[{Range[10], 2 * Range[10]}, {2007}, PlotHighlighting -> Directive[Red, AbsolutePointSize[10], DropShadowing[]]]DateListPlot[{Range[10], 2 * Range[10]}, {2007}, PlotHighlighting -> "Dropline"]DateListPlot[Range[10], {2007}, PlotHighlighting -> "Dropline"]DateListPlot[Range[10], {2007}, PlotHighlighting -> Placed["Dropline", DateObject[{2011, 1, 1}]]]将鼠标移到绘图上方,可用一个显示与
位置相对应的
值的切面来对其突出显示:
DateListPlot[{Range[10], 2 * Range[10]}, {2007}, PlotHighlighting -> "XSlice"]DateListPlot[Range[10], {2007}, PlotHighlighting -> Placed["XSlice", DateObject[{2014, 1, 1}]]]将鼠标移到绘图上方,用一个显示与
位置相对应的
值的切面对其突出显示:
DateListPlot[{Range[10], 2 * Range[10]}, {2007}, PlotHighlighting -> "YSlice"]DateListPlot[{Range[10], 2 * Range[10]}, {2007}, PlotHighlighting -> Placed["YSlice", 10]]DateListPlot[{Range[10], 2 * Range[10]}, {2007}, PlotHighlighting -> "XNearestPoint"]DateListPlot[{Range[10], 2 * Range[10]}, {2007}, PlotHighlighting -> {"XNearestPoint", <|"Style" -> StandardGray|>}]DateListPlot[{Range[10], 2 * Range[10]}, {2007}, PlotHighlighting -> "XYLabel"]使用 Callout 选项改变标签样式:
DateListPlot[{Range[10], 2 * Range[10]}, {2007}, PlotHighlighting -> {"XYLabel", <|"Appearance" -> "Corners", "CalloutMarker" -> "Circle"|>}]DateListPlot[{Range[10], 2 * Range[10]}, {2007}, PlotHighlighting -> {{"XNearestPoint", <|"Style" -> StandardGray|>}, {"XYLabel", <|"Appearance" -> "Corners", "CalloutMarker" -> "Circle"|>}}]PlotInteractivity (3)
DateListPlot[{{2, 3, 5, 7, 11}, {13, 17, 19, 23, 29}}, Today]DateListPlot[{{2, 3, 5, 7, 11}, {13, 17, 19, 23, 29}}, Today, PlotInteractivity -> False]DateListPlot[{{2, 3, 5, 7, 11}, Tooltip[{13, 17, 19, 23, 29}, "hello"]}, Today, PlotInteractivity -> <|"User" -> True, "System" -> False|>]PlotLabel (1)
PlotLabels (4)
data1 = Transpose[{DateRange[{2000, 1, 1}, {2000, 1, 15}], RandomReal[10, 15]}];data2 = Transpose[{DateRange[{2000, 1, 1}, {2000, 1, 15}], RandomReal[10, 15]}];DateListPlot[{data1, data2}, PlotLabels -> {"label1", "label2"}]Use an Association form to specify labels:
DateListPlot[{data1, data2}, PlotLabels -> <|"Lists" -> {"label1", "label2"}|>]ge = FinancialData["GE", "Jan. 1, 2000"];DateListPlot[ge, PlotLabels -> Placed["high", Above]]DateListPlot[ge, PlotLabels -> Placed["label", {DateObject[{2009, 1, 1}], Below}]]DateListPlot[ge, PlotLabels -> Callout["label", {DateObject[{2009, 1, 1}], Above}]]PlotLabelAutomatic 使用 Association 中的键作为数据标签:
DateListPlot[<|"a" -> Accumulate@RandomInteger[10, 10], "b" -> Accumulate@RandomInteger[10, 10]|>, {2007}, PlotLabels -> Automatic, PlotLegends -> None]用 None 表示不添加标签:
data1 = Transpose[{DateRange[{2000, 1, 1}, {2000, 1, 15}], Accumulate@RandomReal[10, 15]}];
data2 = Transpose[{DateRange[{2000, 1, 1}, {2000, 1, 15}], Accumulate@RandomReal[3, 15]}];DateListPlot[{data1, data2}, PlotLabels -> {"label1", None}]PlotLayout (4)
data1 = {{DateObject[{2016, 10, 1}, "Day", "Gregorian", -5.], 10}, {DateObject[{2016, 10, 15}, "Day", "Gregorian", -5.], 17}, {DateObject[{2016, 10, 30}, "Day", "Gregorian", -5.], 15}, {DateObject[{2016, 11, 20}, "Day", "Gregorian", -5.], 20}};data2 = {{DateObject[{2016, 10, 1}, "Day", "Gregorian", -5.], 15}, {DateObject[{2016, 10, 15}, "Day", "Gregorian", -5.], 7}, {DateObject[{2016, 10, 30}, "Day", "Gregorian", -5.], 12}, {DateObject[{2016, 11, 20}, "Day", "Gregorian", -5.], 10}};DateListPlot[{data1, data2}]DateListPlot[{data1, data2}, PlotLayout -> "Stacked"]DateListPlot[{data1, data2}, PlotLayout -> "Percentile"]DateListPlot[{IconizedObject[«Phoenix»], IconizedObject[«Boston»], IconizedObject[«Portland»]}, ImageSize -> Medium, PlotLayout -> "Column"]DateListPlot[{IconizedObject[«Phoenix»], IconizedObject[«Boston»], IconizedObject[«Portland»]}, PlotLayout -> "Row"]DateListPlot[{IconizedObject[«Phoenix»], IconizedObject[«Boston»], IconizedObject[«Portland»]}, PlotLayout -> "Row", PlotLabels -> {"Phoenix", "Boston", "Portland"}]DateListPlot[{IconizedObject[«Chicago»], IconizedObject[«Miami»], IconizedObject[«Phoenix»], IconizedObject[«Boston»], IconizedObject[«Portland»], IconizedObject[«Denver»]}, PlotLayout -> {"Column", 4}]DateListPlot[{IconizedObject[«Chicago»], IconizedObject[«Miami»], IconizedObject[«Phoenix»], IconizedObject[«Boston»], IconizedObject[«Portland»], IconizedObject[«Denver»]}, PlotLayout -> {"Column", UpTo[4]}]PlotLegends (7)
PlotLegends 匹配图形中的样式:
DateListPlot[{Range[10], Range[10] + 3}, {2007}, PlotStyle -> {Directive[AbsolutePointSize[4], Blue], Directive[AbsolutePointSize[8], Red]}, PlotLegends -> Automatic]PlotLegends 匹配图形中的标记:
DateListPlot[{Range[10], Range[10] ^ 2}, {2007}, PlotMarkers -> Automatic, PlotLegends -> Automatic]DateListPlot[{Range[10], Range[10] + 3, Sqrt@Range[10], Log@Range[10]}, {2007}, PlotLegends -> {"a", "b", "c", "d"}]使用 Association 形式来指定图例:
DateListPlot[{Range[10], Range[10] + 3, Sqrt@Range[10], Log@Range[10]}, {2007}, PlotLegends -> <|"Lists" -> {"a", "b", "c", "d"}|>]使用 TimeSeries 中的 MetaInformation:
data = TemporalData[TimeSeries, {{{{1662.33502197266, 1572.}, {1653.52496337891, 1563.},
{1634.92498779297, 1536.5}, {1642.40002441406, 1525.5}, {1642.40002441406, 1525.5},
{1640.23498535156, 1521.5}, {1638.70001220703, 1530.}, {1606.10504150391 ... 1,
{"Continuous", 1}, {"Discrete", 1}, 2,
{MetaInformation -> {"MetalList" -> {"Gold", "Platinum"}, "Unit" -> "USDollars"/"TroyOunces"},
ResamplingMethod -> {"Interpolation", InterpolationOrder -> 1}, ValueDimensions -> 2}}, True,
10.];查看可用的 MetaInformation:
data["MetaInformation"]data["MetalList"]DateListPlot[data, PlotLegends -> data["MetalList"]]使用 Placed 指定图例位置:
Table[DateListPlot[{Range[10], Range[10] + 3}, {2007}, PlotLegends -> Placed[Automatic, pos], PlotLabel -> pos], {pos, {Above, Below}}]Table[DateListPlot[{Range[10], Range[10] + 3}, {2007}, PlotLegends -> Placed[Automatic, pos], PlotLabel -> pos], {pos, {Before, After}}]使用 PointLegend 改变图例的外观:
DateListPlot[{Range[10], Range[10] + 3}, {2007}, PlotLegends -> PointLegend[Automatic, {"list1", "list2"}, LegendFunction -> Panel, LegendMargins -> 5]]PlotRange (1)
PlotStyle (5)
DateListPlot[TimeSeries[TimeEventSeries`TimestampData[Association["UniformlySpacedQ" -> False,
"Timestamps" -> TabularColumn[Association[
"Data" -> {753, {{{1641168000000, 1641254400000, 1641340800000, 1641427200000, 1641513600000,
1641772 ... 22,
139.6699981689453, 140.22000122070312, 139.92999267578125, 137.00999450683594,
137.49000549316406, 134.2899932861328}, {}, None}}, None},
"ElementType" -> TypeSpecifier["Quantity"]["Real64", "USDollars"]]], Association[]], PlotStyle -> Red]DateListPlot[{TimeSeries[TimeEventSeries`TimestampData[Association["UniformlySpacedQ" -> False,
"Timestamps" -> TabularColumn[Association[
"Data" -> {1508, {{{1577923200000, 1578009600000, 1578268800000, 1578355200000,
1578441600000, 157852 ... 4550781, 314.7300109863281, 315.5299987792969, 316.75, 315.1400146484375,
311.5799865722656, 311.7900085449219, 308.0299987792969}, {}, None}}, None},
"ElementType" -> TypeSpecifier["Quantity"]["Real64", "USDollars"]]], Association[]], TimeSeries[TimeEventSeries`TimestampData[Association["UniformlySpacedQ" -> False,
"Timestamps" -> TabularColumn[Association[
"Data" -> {1508, {{{1577923200000, 1578009600000, 1578268800000, 1578355200000,
1578441600000, 157852 ... 183.69000244140625, 189.2100067138672,
188.61000061035156, 190.52999877929688, 188.22000122070312, 187.5399932861328, 186.5}, {},
None}}, None}, "ElementType" -> TypeSpecifier["Quantity"]["Real64", "USDollars"]]],
Association[]]}]DateListPlot[{TimeSeries[TimeEventSeries`TimestampData[Association["UniformlySpacedQ" -> False,
"Timestamps" -> TabularColumn[Association[
"Data" -> {1508, {{{1577923200000, 1578009600000, 1578268800000, 1578355200000,
1578441600000, 157852 ... 4550781, 314.7300109863281, 315.5299987792969, 316.75, 315.1400146484375,
311.5799865722656, 311.7900085449219, 308.0299987792969}, {}, None}}, None},
"ElementType" -> TypeSpecifier["Quantity"]["Real64", "USDollars"]]], Association[]], TimeSeries[TimeEventSeries`TimestampData[Association["UniformlySpacedQ" -> False,
"Timestamps" -> TabularColumn[Association[
"Data" -> {1508, {{{1577923200000, 1578009600000, 1578268800000, 1578355200000,
1578441600000, 157852 ... 183.69000244140625, 189.2100067138672,
188.61000061035156, 190.52999877929688, 188.22000122070312, 187.5399932861328, 186.5}, {},
None}}, None}, "ElementType" -> TypeSpecifier["Quantity"]["Real64", "USDollars"]]],
Association[]]}, PlotStyle -> {RGBColor[0.4, 0.6, 1], RGBColor[0.14, 0.8, 0.14]}]PlotStyle 同时应用于线和点:
DateListPlot[{TimeSeries[TimeEventSeries`TimestampData[Association["UniformlySpacedQ" -> False,
"Timestamps" -> TabularColumn[Association[
"Data" -> {1508, {{{1577923200000, 1578009600000, 1578268800000, 1578355200000,
1578441600000, 157852 ... 4550781, 314.7300109863281, 315.5299987792969, 316.75, 315.1400146484375,
311.5799865722656, 311.7900085449219, 308.0299987792969}, {}, None}}, None},
"ElementType" -> TypeSpecifier["Quantity"]["Real64", "USDollars"]]], Association[]], TimeSeries[TimeEventSeries`TimestampData[Association["UniformlySpacedQ" -> False,
"Timestamps" -> TabularColumn[Association[
"Data" -> {1508, {{{1577923200000, 1578009600000, 1578268800000, 1578355200000,
1578441600000, 157852 ... 183.69000244140625, 189.2100067138672,
188.61000061035156, 190.52999877929688, 188.22000122070312, 187.5399932861328, 186.5}, {},
None}}, None}, "ElementType" -> TypeSpecifier["Quantity"]["Real64", "USDollars"]]],
Association[]]}, Joined -> {True, False}, PlotStyle -> RGBColor[0.14, 0.8, 0.14]]DateListPlot[EventSeries[TimeEventSeries`TimestampData[Association["UniformlySpacedQ" -> False,
"Timestamps" -> TabularColumn[Association[
"Data" -> {12, {{NumericArray[{20089, 20120, 20148, 20179, 20209, 20240, 20270, 20301, 20332,
20362, ... 146, 166}, {}, None}, "ElementType" -> "Integer64"]],
TabularColumn[Association["Data" -> {{204, 188, 235, 227, 234, 264, 302, 293, 259, 229,
203, 229}, {}, None}, "ElementType" -> "Integer64"]]}}]]]], Association[]], PlotStyle -> <|"Base" -> PointSize[Large]|>]DateListPlot[EventSeries[TimeEventSeries`TimestampData[Association["UniformlySpacedQ" -> False,
"Timestamps" -> TabularColumn[Association[
"Data" -> {12, {{NumericArray[{20089, 20120, 20148, 20179, 20209, 20240, 20270, 20301, 20332,
20362, ... 146, 166}, {}, None}, "ElementType" -> "Integer64"]],
TabularColumn[Association["Data" -> {{204, 188, 235, 227, 234, 264, 302, 293, 259, 229,
203, 229}, {}, None}, "ElementType" -> "Integer64"]]}}]]]], Association[]], PlotStyle -> <|"Lists" -> {RGBColor[0.14, 0.8, 0.14], RGBColor[0.93, 0.27, 0.27], RGBColor[0.4, 0.6, 1]}|>]DateListPlot[EventSeries[TimeEventSeries`TimestampData[Association["UniformlySpacedQ" -> False,
"Timestamps" -> TabularColumn[Association[
"Data" -> {12, {{NumericArray[{20089, 20120, 20148, 20179, 20209, 20240, 20270, 20301, 20332,
20362, ... 146, 166}, {}, None}, "ElementType" -> "Integer64"]],
TabularColumn[Association["Data" -> {{204, 188, 235, 227, 234, 264, 302, 293, 259, 229,
203, 229}, {}, None}, "ElementType" -> "Integer64"]]}}]]]], Association[]], PlotStyle -> <|"Base" -> PointSize[Large], "Lists" -> {StandardGreen, StandardRed, StandardBlue}|>]PlotTheme (2)
Prolog (1)
用缩写的 DateList 作为
坐标放置文本:
DateListPlot[Range[10], {2007}, Prolog :> Text["linear trend", {{2010, 1, 15}, 6}]]ScalingFunctions (7)
DateListPlot[TimeSeries[{1, 1, 4, 9, 25, 64, 121}, {"Jan 1, 2015"}]]DateListPlot[TimeSeries[{1, 1, 4, 9, 25, 64, 121}, {"Jan 1, 2015"}], ScalingFunctions -> "Log"]DateListPlot[TimeSeries[{1, 1, 4, 9, 25, 64, 121}, {"Jan 1, 2015"}], ScalingFunctions -> "Reverse"]DateListPlot[TimeSeries[{1, 1, 2, 3, 5, 8, 11}, {"Jan 1, 2015"}], ScalingFunctions -> "Reciprocal"]DateListPlot[TimeSeries[{1, 1, 4, 9, 25, 64, 121}, {"Jan 1, 2015"}], ScalingFunctions -> {-Log[#]&, Exp[-#]&}]FrameTicks 和 GridLines 中的位置是自动缩放的:
DateListPlot[TimeSeries[{1, 1, 4, 9, 25, 64, 121}, {"Jan 1, 2015"}], ScalingFunctions -> "Log", FrameTicks -> {Automatic, 2 ^ Range[0, 10]}, GridLines -> {None, 2 ^ Range[0, 10]}]PlotRange 是自动缩放的:
DateListPlot[TimeSeries[{1, 1, 4, 9, 25, 64, 121}, {"Jan 1, 2015"}], ScalingFunctions -> "Log", PlotRange -> {0.5, 500}]TargetUnits (1)
Ticks (10)
DateListPlot[Range[10], {2007}, Axes -> True, Frame -> False]DateListPlot[Range[10], {2007}, Frame -> False, Axes -> True, Ticks -> {None, None}]DateListPlot[Range[10], {2007}, Frame -> False, Axes -> True, Ticks -> {Automatic, None}]DateListPlot[Range[10], {2007}, Frame -> False, Axes -> True, Ticks -> {{"July 1, 2011", "July 1, 2014"}, {2, 3, 5, 7, 9}}]DateListPlot[Sqrt[Range[10]], {2007, 4, 10}, Ticks -> {{"April 12, 2007", "April 18, 2007"}, Automatic}, Axes -> True, Frame -> False]DateListPlot[Sqrt[Range[10]], {2007, 4, 10}, Ticks -> {{3385324800, 3385843200}, Automatic}, Axes -> True, Frame -> False]DateListPlot[Range[10], {2007}, Frame -> False, Axes -> True, Ticks -> {{{"July 1, 2011", "year 1"}, {"July 1, 2014", "year 2"}}, {{2, "two"}, {5, "five"}, {9, "nine"}}}]DateListPlot[Range[10], {2007}, Frame -> False, Axes -> True, Ticks -> {{{"July 1, 2011", "year 1"}, {"July 1, 2014", "year 2"}}, Automatic}]DateListPlot[Range[10], {2007}, Frame -> False, Axes -> True, Ticks -> {{{"July 1, 2011", "a", .3}, {"July 1, 2014", "b", .5}}, Automatic}]DateListPlot[Range[10], {2007}, Frame -> False, Axes -> True, Ticks -> {{{"July 1, 2011", "a", {.3, .1}}, {"July 1, 2014", "b", {.5, .2}}}, Automatic}]DateListPlot[Range[10], {2007}, Frame -> False, Axes -> True, Ticks -> {{{"July 1, 2011", "a", .3, Directive[Blue, Thick]}, {"July 1, 2014", "b", .5, Directive[StandardGray, Thick, Dashed]}}, Automatic}]minMeanMax[min_, max_] := {{min, min}, {(max + min) / 2, (max + min) / 2}, {max, max}}DateListPlot[Range[10], {2007}, Frame -> False, Axes -> True, Ticks -> {Automatic, minMeanMax}, PlotRangePadding -> None]TicksStyle (4)
DateListPlot[Range[10], {2007}, Frame -> False, Axes -> True, AxesStyle -> Red]DateListPlot[Range[10], {2007}, Frame -> False, Axes -> True, TicksStyle -> Directive[Red]]DateListPlot[Range[10], {2007}, Frame -> False, Axes -> True, TicksStyle -> {Directive[Green, Thick], Directive[Blue, Thick]}]DateListPlot[Range[10], {2007}, Frame -> False, Axes -> True, TicksStyle -> Directive[Red, Thick], LabelStyle -> Blue]应用 (2)
data = FinancialData["GE", {2000, 1, 1}];DateListPlot[data, Joined -> True, Filling -> Bottom]data = {56.1, 60.7, 51.6, 52., 57.5, 56.7, 67.4, 69.9, 72.9, 69.7, 70.3, 72.1};DateListPlot[data, {{2006, 6, 1, 8}, Automatic, "Hour"}]DateListPlot[data, {{2006, 6, 1, 8}, Automatic, "Hour"}, DateTicksFormat -> {"Hour12Short", "AMPMLowerCase"}]属性和关系 (2)
data = Transpose[{Table[{1900, 1, 1, i}, {i, 24}], Range[24]}];DateListPlot[data, GridLines -> {{5 10 ^ 4}, None}]用 AbsoluteTime 值的一个 ListPlot:
lpdata = data;
lpdata[[All, 1]] = Map[AbsoluteTime, data[[All, 1]]];ListPlot[lpdata, GridLines -> {{5 10 ^ 4}, None}, Frame -> True]DateListLogPlot 在对数尺度上绘制一个基于日期的数据:
DateListLogPlot[Exp[Range[15]], {2008, 1, 1}]DateListPlot[Exp[Range[15]], {2008, 1, 1}]历史
2007年引入 (6.0) | 在以下年份被更新:2008 (7.0) ▪ 2012 (9.0) ▪ 2014 (10.0) ▪ 2016 (10.4) ▪ 2016 (11.0) ▪ 2018 (11.3) ▪ 2019 (12.0) ▪ 2021 (13.0) ▪ 2023 (13.3) ▪ 2025 (14.2) ▪ 2025 (14.3) ▪ 2026 (15.0)
文本
Wolfram Research (2007),DateListPlot,Wolfram 语言函数,https://reference.wolfram.com/language/ref/DateListPlot.html (更新于 2026 年).
CMS
Wolfram 语言. 2007. "DateListPlot." Wolfram 语言与系统参考资料中心. Wolfram Research. 最新版本 2026. https://reference.wolfram.com/language/ref/DateListPlot.html.
APA
Wolfram 语言. (2007). DateListPlot. Wolfram 语言与系统参考资料中心. 追溯自 https://reference.wolfram.com/language/ref/DateListPlot.html 年
BibTeX
@misc{reference.wolfram_2026_datelistplot, author="Wolfram Research", title="{DateListPlot}", year="2026", howpublished="\url{https://reference.wolfram.com/language/ref/DateListPlot.html}", note=[Accessed: 03-August-2026]}
BibLaTeX
@online{reference.wolfram_2026_datelistplot, organization={Wolfram Research}, title={DateListPlot}, year={2026}, url={https://reference.wolfram.com/language/ref/DateListPlot.html}, note=[Accessed: 03-August-2026]}