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

Give a try to drawing differently native MLS

parent 5f09d42a
No related branches found
No related tags found
No related merge requests found
......@@ -7,6 +7,9 @@ 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.3)
......@@ -28,19 +31,21 @@ 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']
axesLabels = ['targets', 'compressed blockchain size (in blocks)', 'compressed blockchain score']
axesYValues = [targets, data['compressSize'], data['compressScore']]
axesColors = ['blue', 'green', 'brown', 'green', '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']]
curves = []
for axis, color, label, yValues in zip(axes, axesColors, axesLabels, axesYValues):
curves += axis.plot(yValues, label = label, color = color)
for curvesIndex, (axis, color, label, yValues) in enumerate(zip(axes + axes[-2:], axesColors, axesLabels, axesYValues)):
curves += axis.plot(yValues, '-' if curvesIndex < 3 else '--', label = label, color = color)
targetsAxis.set_yscale('log')
axes[2].spines.right.set_position(('axes', 1.1))
axes[2].set_yscale('log')
legendNewLine = targetsAxis.plot([], [], color='none', label=' ')
sameAxes = targetsAxis.plot([], [], color='none', label='Respectively same axes as two previous curves:')
curves.insert(-2, sameAxes[0])
curves += legendNewLine + targetRecomputationCurve + [firstTargetDecreaseCurve] + [targetIncreaseCurve]
labels = [curve.get_label() for curve in curves]
......@@ -54,6 +59,6 @@ for ax, color in zip(axes, axesColors):
plt.title('Variable difficulty Bitcoin compressed blockchain evolution')
#plt.show()
plt.show()
fig.set_size_inches((11.2, 7.5), forward=False)
plt.savefig('data.svg')
\ No newline at end of file
#plt.savefig('data.svg')
\ No newline at end of file
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment