-
-
Save bczhc/4088589c2bbe8cee1eb01f8f9ee94fd0 to your computer and use it in GitHub Desktop.
Wolfram绘制时间-日期图表 #wolfram
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| plotHourDateScatter[timestamps_List] := | |
| Module[{timeList, hours, data, ts}, | |
| timeList = timestamps // FromUnixTime /@ # &; | |
| hours = DateValue[#, "HourExact"] & /@ timeList // Parallelize; | |
| data = MapThread[{#1, #2} &, {timeList, hours}]; | |
| ts = TimeSeries[data]; | |
| DateListPlot[ts, Joined -> False, ScalingFunctions -> "Reverse", | |
| FrameLabel -> {"Date", "Time"}, ImageSize -> Large, | |
| FrameTicks -> {{Table[{x, | |
| StringRepeat["0", 2 - StringLength[ToString@x]] <> | |
| ToString@x <> ":00"}, {x, 0, 24, 2}], None}, {Automatic, | |
| None}}, PlotRange -> {Full, {-0.2, 24.2}}, | |
| DateTicksFormat -> {"Year", "/", "Month"} | |
| ] | |
| ]; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment