Package: hdtimelines
hdtimelinesA Python package for creating graphical timelines of historical data usingPlotlyGithub:https://github.com/dh3968mlq/hdtimelinesDocumentation:https://hdtimelines.readthedocs.io/en/PyPI:https://pypi.org/project/hdtimelines/An app that uese this package:https://timeflows.uk/Some starter datasets (.csv):https://github.com/dh3968mlq/historicaldate-dataUses thehistoricaldatepackage for dates:Dates in input files are in a natural readable format, such as '25 Dec 1066'Dates can be uncertain (e.g. 'circa 1028') and can be BC (e.g. '525 BC')It is possible to specify start and end dates of persistent events, such as a wars or monarchs' reigns, and/or birth and death dates of personsIn the timeline display:To create a timeline:Install this package:pip install hdtimelinesDownload sample data fromhttps://github.com/dh3968mlq/historicaldate-data, and/orCreate .csv files of data (see below for column names and date formats)Create and run a Python program, similar to below, or see sample timeline code in thetimelinesfolder in this repositorySample code:# Sample code for a timeline of British monarchs and Prime Ministers# The folder that historicaldate-data has been downloaded to...dataroot="/svol1/pishare/users/pi/repos/timelines2/historicaldate-data"fromhdtimelinesimportpltimelineimportpandasaspddf1=pd.read_csv(f"{dataroot}/data/History/Europe/English and British Monarchs.csv",na_filter=False)df2=pd.read_csv(f"{dataroot}/data/History/Europe/British Prime Ministers.csv",na_filter=False)pltl=pltimeline.plTimeLine()pltl.add_topic_from_df(df1,title="English and British Monarchs")pltl.add_topic_from_df(df2,title="British Prime Ministers")pltl.show()# Show in a browser, or...pltl.write_html("/home/pi/example_timeline.html")Input file formatDataframes passed toadd_topic_from_dfhave one row per event or life, and specific column names.labelmust be present, together with eitherhdateor both ofhdate_birthandhdate_death. All other columns are optional.ColumnUsagelabelEvent label, appears on the timelinedescriptionExtended description, used for hovertexthdateDate of event, or start date if it is a persistent eventhdate_endEnd date of a persistent eventhdate_birthA person's birth datehdate_deathA person's date of death, defaults toaliveifhdate_birthis presenthtext_endHover text linked to the marker drawn athdate_endcolor (or colour)Colour to draw the event or lifeurlhyperlink, active by clicking on the displayed labelrankAn integer, use together withmax_rankto control which rows are displayedmin_xrange_yearsAn integer. The event is displayed only if the displayed date range is greater thanmin_xrange_yearsmax_xrange_yearsAn integer. The event is displayed only if the displayed date range is less than or equal tomax_xrange_yearsDate formatsDate formats are described in detail athttps://historicaldate.readthedocs.io/en/In brief:Two core formats are supported by default:25 Dec 1066 (and variants)1066-12-25Additional non-default formats available:25/12/106612/25/1066Dec 25 1066Imprecise dates, such as '1066' or 'circa 1066' are allowedBC dates are supported such as '385 BC'Ongoing events and lives are supported by settinghdate_endorhdate_deathto 'ongoing'. A blank value ofhdate_deathisinterprested as meaning a person is still alive.ChangesNew in 0.1.1max_xrange_years,min_xrange_yearsNew in 0.1.0Released to PyPI and documentation on readthedocsNew in 0.0.7Split from historicaldate package (https://github.com/dh3968mlq/historicaldate)New in 0.0.6add_event_setrenamed toadd_topic_from_dfNew in 0.0.5BC dates can now be displayed on timelines (xmode=years)X-axis (date axis) labels moved to topNew in 0.0.4add_event_set()now updates yaxes to fit the displayed dataNew methodplTimeLine().fit_xaxis(self, mindate=None, maxdate=None)that fits the X axis either to the data or to a specified range of datesX axis date labels moved to top of displayStudy range filtering added, parametersstudy_range_startandstudy_range_endof theadd_event_setmethod. Event sets lying entirely outside the study range are not displayed.Filtering on the value of arankcolumn in input data, parametermax_rankof theadd_event_setmethod.New in 0.0.3New English Football timeline code (english_football.py)Newhover_datetypeparameter toadd_event_setNewhtext_endcolumn supported