removing some duplicate code
This commit is contained in:
@@ -2,43 +2,8 @@ from matplotlib.ticker import MultipleLocator,FuncFormatter,NullFormatter
|
||||
import matplotlib.pyplot as plt
|
||||
|
||||
import numpy as np
|
||||
from rows import format_pace_tick, format_pace, format_time, format_time_tick
|
||||
|
||||
# Make pace ticks for pace axis '2:00', '1:50', etc
|
||||
def format_pace_tick(x,pos=None):
|
||||
min=int(x/60)
|
||||
sec=int(x-min*60.)
|
||||
sec_str=str(sec).zfill(2)
|
||||
template='%d:%s'
|
||||
return template % (min,sec_str)
|
||||
|
||||
# Returns a pace string from a pace in seconds/500m, '1:45.4'
|
||||
def format_pace(x,pos=None):
|
||||
if isinf(x) or isnan(x):
|
||||
x=0
|
||||
|
||||
min=int(x/60)
|
||||
sec=(x-min*60.)
|
||||
|
||||
str1 = "{min:0>2}:{sec:0>4.1f}".format(
|
||||
min = min,
|
||||
sec = sec
|
||||
)
|
||||
|
||||
return str1
|
||||
|
||||
# Returns a time string from a time in seconds
|
||||
def format_time(x,pos=None):
|
||||
|
||||
|
||||
min = int(x/60.)
|
||||
sec = int(x-min*60)
|
||||
|
||||
str1 = "{min:0>2}:{sec:0>4.1f}".format(
|
||||
min=min,
|
||||
sec=sec,
|
||||
)
|
||||
|
||||
return str1
|
||||
|
||||
# Formatting the distance tick marks
|
||||
def format_dist_tick(x,pos=None):
|
||||
@@ -46,13 +11,6 @@ def format_dist_tick(x,pos=None):
|
||||
template='%6.3f'
|
||||
return template % (km)
|
||||
|
||||
# Formatting the time tick marks (h:mm)
|
||||
def format_time_tick(x,pos=None):
|
||||
hour=int(x/3600)
|
||||
min=int((x-hour*3600.)/60)
|
||||
min_str=str(min).zfill(2)
|
||||
template='%d:%s'
|
||||
return template % (hour,min_str)
|
||||
|
||||
# Utility to select reasonable y axis range
|
||||
# Basically the data range plus some padding, but with ultimate
|
||||
|
||||
Reference in New Issue
Block a user