Skip to content
Snippets Groups Projects
Unverified Commit bc9f690c authored by Benjamin Loison's avatar Benjamin Loison
Browse files

Try adding the block height to the x-axis

parent ec9b65dd
No related branches found
No related tags found
No related merge requests found
......@@ -24,7 +24,7 @@ axes = [targetsAxis, compressedSizeAxis, compressedScoreAxis, targetsAxis.twinx(
targets = data['targets']
timestamps = [datetime.datetime.fromtimestamp(timestamp) for timestamp in data['timestamps']]
timestamps = [(timestampsIndex, datetime.datetime.fromtimestamp(timestamp)) for timestampsIndex, timestamp in enumerate(data['timestamps'])]
for x, (target, nextTarget) in enumerate(zip(targets, targets[1:])):
if nextTarget < target:
......@@ -46,7 +46,8 @@ axesYValues = [targets, data['compressSize'], data['compressScore'], dataConstan
class CustomDateFormatter(mdates.ticker.Formatter):
def __call__(self, x, pos=0):
result = mdates.num2date(x).strftime('%m/%Y')
blockHeight, timestamp = x
result = mdates.num2date(timestamp).strftime(f'%m/%Y - {blockHeight}')
return result
plt.gca().xaxis.set_major_formatter(CustomDateFormatter())
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment