Fix labels with different units.
This commit is contained in:
parent
7087b5299a
commit
5394bcee7c
@ -6,10 +6,8 @@ __author__ = 'Timothy Allen'
|
||||
__email__ = 'tim@treehouse.org.za'
|
||||
__license__ = 'MIT'
|
||||
|
||||
# TODO: comments -- unicode
|
||||
# TODO: prettify
|
||||
# TODO: comments -- unicode/images/np.array
|
||||
# TODO: weekly graph with each day's figures as a different-coloured line
|
||||
# TODO: verify either set of units (mmol/L,mg/dl) works with the data
|
||||
|
||||
import argparse
|
||||
import csv
|
||||
@ -419,13 +417,18 @@ def generate_plot(data, ax=None, transforms={}, args=[], **plot_args):
|
||||
# XXX At present, backend_pdf does not parse unicode correctly, and all recent
|
||||
# unicode chacters that lack proper glyph names are massed together and printed
|
||||
# as the same character
|
||||
if args.units == UNIT_MMOLL:
|
||||
y_offset = 6
|
||||
else:
|
||||
y_offset = convert_glucose_unit(6, UNIT_MMOLL)
|
||||
|
||||
if transform == 'label' and transforms[transform] is True:
|
||||
for a, b, label in zip(x, y, z):
|
||||
for x_pos, y_pos, label in zip(x, y, z):
|
||||
if len(label) > 0:
|
||||
#print(label)
|
||||
ax.annotate(
|
||||
label,
|
||||
xy=(a, args.graph_max-6),
|
||||
xy=(x_pos, args.graph_max-y_offset),
|
||||
rotation=45,
|
||||
zorder=25,
|
||||
)
|
||||
|
Loading…
Reference in New Issue
Block a user