diff --git a/lib/xmet/hodograph.py b/lib/xmet/hodograph.py index 48e0ace..21a8409 100644 --- a/lib/xmet/hodograph.py +++ b/lib/xmet/hodograph.py @@ -174,7 +174,7 @@ class Hodograph(): cr.save() cr.set_source_rgb(1, 1, 1) - cr.rectangle(offset + x - width / 2, + cr.rectangle(offset + x - width * 0.75, y + width, interval * 4, width * 3) @@ -182,7 +182,7 @@ class Hodograph(): cr.fill() cr.set_source_rgb(0.8, 0.8, 0.8) - cr.rectangle(offset + x - width / 2, + cr.rectangle(offset + x - width * 0.75, y + width, interval * 4, width * 3) @@ -201,13 +201,11 @@ class Hodograph(): cr.rectangle(offset + x, y + width * 1.5, width, width) cr.stroke() - cr.move_to(offset + x, y + 3.5*width) - - if height < 1000: - cr.show_text("%dm" % height) - else: - cr.show_text("%dkm" % (height / 1000)) + text = "%dm" % (height) if height < 1000 else "%dkm" % (height /1000) + extents = cr.text_extents(text) + cr.move_to(offset + x - extents.width / 4, y + 3.5*width) + cr.show_text(text) cr.stroke() offset += interval