Skip to content
Snippets Groups Projects
Unverified Commit 4e0f1dfc authored by Benjamin Loison's avatar Benjamin Loison
Browse files
parent dcfedc7b
No related branches found
No related tags found
No related merge requests found
......@@ -44,6 +44,36 @@ axesColors = ['blue', 'green', 'brown', 'orange', 'brown', 'red', 'purple']
axesLabels = ['targets', 'compressed blockchain size (in blocks)', 'compressed blockchain score', 'constant difficulty compressed blockchain size (in blocks)', 'constant difficulty compressed blockchain score', 'compressed blockchain size keeping all blocks since last m higher block (in blocks)', 'compressed blockchain score keeping all blocks since last m higher block']
axesYValues = [targets, data['compressSize'], data['compressScore'], dataConstantDifficulty['compressSize'], dataConstantDifficulty['compressScore'], dataKeepingAllBlocksSinceLastMHigherBlock['compressSize'], dataKeepingAllBlocksSinceLastMHigherBlock['compressScore']]
class DateFormatter(ticker.Formatter):
"""
Format a tick (in days since the epoch) with a
`~datetime.datetime.strftime` format string.
"""
def __init__(self, fmt, tz=None, *, usetex=None):
"""
Parameters
----------
fmt : str
`~datetime.datetime.strftime` format string
tz : str or `~datetime.tzinfo`, default: :rc:`timezone`
Ticks timezone. If a string, *tz* is passed to `dateutil.tz`.
usetex : bool, default: :rc:`text.usetex`
To enable/disable the use of TeX's math mode for rendering the
results of the formatter.
"""
self.tz = _get_tzinfo(tz)
self.fmt = fmt
self._usetex = (usetex if usetex is not None else
mpl.rcParams['text.usetex'])
def __call__(self, x, pos=0):
result = num2date(x, self.tz).strftime(self.fmt)
return _wrap_in_tex(result) if self._usetex else result
def set_tzinfo(self, tz):
self.tz = _get_tzinfo(tz)
plt.gca().xaxis.set_major_formatter(mdates.DateFormatter('%m/%Y'))
curves = []
......@@ -70,7 +100,7 @@ curves.insert(-2, legendNewLine[0])
curves += legendNewLine + targetRecomputationCurve + [firstTargetDecreaseCurve] + [targetIncreaseCurve]
labels = [curve.get_label() for curve in curves]
plt.legend(curves, labels, loc='upper center', framealpha=1, bbox_to_anchor=(0.5, -0.125))
#plt.legend(curves, labels, loc='upper center', framealpha=1, bbox_to_anchor=(0.5, -0.125))
targetsAxis.set_xlabel('Block height')
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment