Skip to content

Commit

Permalink
Add "ago"
Browse files Browse the repository at this point in the history
Fixes #2977
  • Loading branch information
hyanwong committed Sep 24, 2024
1 parent 0403de0 commit af5a188
Show file tree
Hide file tree
Showing 9 changed files with 11 additions and 11 deletions.
2 changes: 1 addition & 1 deletion python/tests/data/svg/tree_both_axes.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion python/tests/data/svg/ts_max_trees.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion python/tests/data/svg/ts_max_trees_treewise.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion python/tests/data/svg/ts_multiroot.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion python/tests/data/svg/ts_plain_y.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion python/tests/data/svg/ts_y_axis.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion python/tests/data/svg/ts_y_axis_regular.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
6 changes: 3 additions & 3 deletions python/tests/test_drawing.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# MIT License
#
# Copyright (c) 2018-2023 Tskit Developers
# Copyright (c) 2018-2024 Tskit Developers
# Copyright (C) 2017 University of Oxford
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
Expand Down Expand Up @@ -2697,7 +2697,7 @@ def test_known_svg_ts_y_axis(self, overwrite_viz, draw_plotbox):
tables.time_units = "generations"
ts = tables.tree_sequence()
svg = ts.draw_svg(y_axis=True, debug_box=draw_plotbox)
assert "Time (generations)" in svg
assert "Time ago (generations)" in svg
self.verify_known_svg(
svg, "ts_y_axis.svg", overwrite_viz, width=200 * ts.num_trees
)
Expand Down Expand Up @@ -2799,7 +2799,7 @@ def test_known_svg_ts_multiroot(self, overwrite_viz, draw_plotbox, caplog):
self.verify_known_svg(
svg, "ts_multiroot.svg", overwrite_viz, width=200 * ts.num_trees
)
assert "Time (generations)" in svg
assert "Time ago (generations)" in svg

def test_known_svg_ts_xlim(self, overwrite_viz, draw_plotbox, caplog):
ts = self.get_simple_ts()
Expand Down
2 changes: 1 addition & 1 deletion python/tskit/drawing.py
Original file line number Diff line number Diff line change
Expand Up @@ -730,7 +730,7 @@ def __init__(
if time_scale == "rank":
y_label = "Node time"
else:
y_label = "Time"
y_label = "Time ago"
if ts.time_units != tskit.TIME_UNITS_UNKNOWN:
y_label += f" ({ts.time_units})"
self.x_label = x_label
Expand Down

0 comments on commit af5a188

Please sign in to comment.