Use more pastel colors
This commit is contained in:
parent
2ec18153d1
commit
deb76959d5
1 changed files with 34 additions and 8 deletions
|
@ -97,15 +97,17 @@ class Hodograph():
|
|||
|
||||
cr.restore()
|
||||
|
||||
COLORS = {
|
||||
500: (1.0, 0.4, 1.0),
|
||||
3000: (1.0, 0.4, 0.4),
|
||||
7000: (0.4, 1.0, 0.4),
|
||||
10000: (0.4, 0.4, 1.0)
|
||||
}
|
||||
|
||||
def color(self, height: float):
|
||||
if height <= 500:
|
||||
return (1, 0, 1)
|
||||
elif height <= 3000:
|
||||
return (1, 0, 0)
|
||||
elif height <= 7000:
|
||||
return (0, 1, 0)
|
||||
elif height <= 10000:
|
||||
return (0, 0, 1)
|
||||
for key in self.COLORS:
|
||||
if height < key:
|
||||
return self.COLORS[key]
|
||||
|
||||
def draw_samples(self,
|
||||
cr: cairo.Context,
|
||||
|
@ -152,6 +154,29 @@ class Hodograph():
|
|||
cr.stroke()
|
||||
cr.restore()
|
||||
|
||||
def draw_height_legends(self, cr: cairo.Context, x, y):
|
||||
width = 0.02380952 * self.width
|
||||
interval = 0.05952380 * self.width
|
||||
offset = 0
|
||||
|
||||
for height in self.COLORS:
|
||||
color = self.COLORS[height]
|
||||
|
||||
cr.save()
|
||||
cr.set_source_rgb(*color)
|
||||
cr.rectangle(offset + x, y, width, width)
|
||||
cr.fill()
|
||||
cr.restore()
|
||||
|
||||
cr.rectangle(offset + x, y, width, width)
|
||||
cr.stroke()
|
||||
|
||||
cr.move_to(offset + x, y + 2*width)
|
||||
cr.show_text("%dkm" % (height / 1000))
|
||||
cr.stroke()
|
||||
|
||||
offset += interval
|
||||
|
||||
def draw(self, cr: cairo.Context, x, y, samples: Iterable[SoundingSample]):
|
||||
self.draw_speed_lines(cr, x, y)
|
||||
self.draw_direction_lines(cr, x, y)
|
||||
|
@ -160,3 +185,4 @@ class Hodograph():
|
|||
|
||||
self.draw_speed_legends(cr, x, y)
|
||||
self.draw_direction_legends(cr, x, y)
|
||||
self.draw_height_legends(cr, x, y)
|
||||
|
|
Loading…
Add table
Reference in a new issue