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

Remove constant difficulty curves and limit the height considered

1. As our approach is in theory not justified (at least proven that it
   makes sense)
2. #5 (comment 12036)
parent e28f1065
Branches
No related tags found
No related merge requests found
......@@ -7,14 +7,14 @@ SHOW_TARGET_RECOMPUTATION = False
with open('data.json') as f:
data = json.load(f)
with open('data_constant_difficulty.json') as f:
dataConstantDifficulty = json.load(f)
fig, targetsAxis = plt.subplots()
fig.subplots_adjust(right = 0.8)
fig.subplots_adjust(bottom = 0.4)
compressedScoreAxis = targetsAxis.twinx()
axes = [targetsAxis, targetsAxis.twinx(), compressedScoreAxis, targetsAxis.twinx(), compressedScoreAxis]
axes = [targetsAxis, targetsAxis.twinx(), compressedScoreAxis]
for key in data:
data[key] = data[key][:428_078]
targets = data['targets']
......@@ -32,23 +32,19 @@ for x, (target, nextTarget) in enumerate(zip(targets, targets[1:])):
if nextTarget > target:
targetIncreaseCurve = plt.axvline(x = x, alpha = 0.5, color = 'red', label = 'target increase')
axesColors = ['blue', 'green', 'brown', 'orange', 'brown']
axesLabels = ['targets', 'compressed blockchain size (in blocks)', 'compressed blockchain score', 'constant difficulty compressed blockchain size (in blocks)', 'constant difficulty compressed blockchain score']
axesYValues = [targets, data['compressSize'], data['compressScore'], dataConstantDifficulty['compressSize'], dataConstantDifficulty['compressScore']]
axesColors = ['blue', 'green', 'brown']
axesLabels = ['targets', 'compressed blockchain size (in blocks)', 'compressed blockchain score']
axesYValues = [targets, data['compressSize'], data['compressScore']]
curves = []
for curvesIndex, (axis, color, label, yValues) in enumerate(zip(axes, axesColors, axesLabels, axesYValues)):
dashes = (None, None) if curvesIndex != 4 else [1, 25]
alpha = 1 if curvesIndex != 3 else 0.5
curves += axis.plot(yValues, label = label, color = color, dashes = dashes, alpha = alpha)
curves += axis.plot(yValues, label = label, color = color)
targetsAxis.set_yscale('log', base=2)
axes[2].spines.right.set_position(('axes', 1.1))
axes[2].set_yscale('log')
axes[-2].spines.right.set_position(('axes', 1.2))
legendNewLine = targetsAxis.plot([], [], color='none', label=' ')
curves.insert(-2, legendNewLine[0])
......@@ -65,6 +61,6 @@ for ax, color in zip(axes, axesColors):
title = 'Variable difficulty Bitcoin compressed blockchain evolution'
plt.title(title)
#plt.show()
plt.show()
fig.set_size_inches((11.2, 7.5), forward=False)
plt.savefig(f'{title.lower().replace(" ", "_")}.svg')
#plt.savefig(f'{title.lower().replace(" ", "_")}.svg')
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment