Interested in Using TimelinePlot to help me understand/remember important time periods in Earth prehistory and history.

Following an a simple example in the Documentation I create a TimelinePlot for Japanese history (data extracted from Wikipedia) using the List of Associations Application example.

TimelinePlot[<| "Yayoi" -> Interval[{"-300", "250"}], 
"Kofun" -> Interval[{"250", "538"}], 
"Asuka" -> Interval[{"538", "710"}], 
"Nara" -> Interval[{"710", "794"}], 
"Heian" -> Interval[{"794", "185"}], 
"Kamakura" -> Interval[{"1185", "1333"}], 
"Kenmu Restoration" -> Interval[{"1333", "1336"}], 
"Muromachi" -> Interval[{"1336", "1573"}], 
"Azuchi-Momoyama" -> Interval[{"1568", "1603"}], 
"Edo" -> Interval[{"1603", "1868"}], 
"Meiji" -> Interval[{"1868", "1912"}], 
"Taisho" -> Interval[{"1912", "1926"}], 
"Showa" -> Interval[{"1925", "1989"}], 
"Heisei" -> Interval[{"1989", "2016"}]|>,  
ImageSize -> {Automatic, 300}]  

This works more or less as expected. However, it does not handle dates prior to Zero (BC) correctly. Note the Yayoi Period beginning in 300 BC and ending in 250 AD is improperly plotted. Similarly, if the Jomon period (14000 BC to 300 BC) is plotted it too gets confused.

Since I am especially interested in date intervals that start back well before historical times but at times may enter into the Common Era, I need to specify dates "BC" correctly. How can one plot intervals that might might cross the Zero boundary (BCE to CE date intervals) so that the plot reads properly? I notice that DateString[] can be modified using $DateStringFormat to handle "ADBC" or "CEBCE" date types. However, I can't seem to figure out how I should respecify the Date Interval[{}] to correctly handle such cases. The documentation is rather thin on this point. Obviously, setting the text number to a minus value within quotes doesn't work. Replacing the first association with

 "Yayoi" -> Interval[{Block[{$DateStringFormat = "ADBC"}, "300 BC"], "250"}]

doesn't either.

Anyone have any suggestions as to the correct way to do this?


DateObject seems to get the job done, e.g.:

"Yayoi" -> Interval[{DateObject[{-300}], "250"}]

enter image description here

| improve this answer | |

It may not be able to help since it has been a while, but the problem was the string format of dates:

In[69]:= DateList["-300"]
Out[69]= {300, 1, 1, 0, 0, 0.}
In[70]:= DateList[{-300}]
Out[70]= {-300, 1, 1, 0, 0, 0.}

Besides Mr.Wizard♦'s suggestion, DateFunction can also be used.

TimelinePlot[data, ImageSize -> {Automatic, 300}, DateFunction -> ({ToExpression@#} &)]

Note that there is another anomaly in the plot; that is "Heian" is blocked by "Kofun", and that is because the dates in the interval for "Heian" is reversed. Fixing it will produce a correct TimelinePlot.

"Heian" -> Interval[{"794", "185"}], 
| improve this answer | |
  • 2
    $\begingroup$ Nevertheless, it might help other people who come across this. Thanks for posting this! $\endgroup$ – J. M.'s technical difficulties Aug 10 '16 at 22:01

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.