diff --git a/lib/xmet/skew_t.py b/lib/xmet/skew_t.py index fcdf5c6..5b0ba83 100644 --- a/lib/xmet/skew_t.py +++ b/lib/xmet/skew_t.py @@ -47,7 +47,7 @@ class SkewTGraph(): return factor * self.height def draw_isobars(self, cr: cairo.Context, x: float, y: float): - cr.set_source_rgb(0.5, 0.5, 0.5) + cr.save() for pressure in range(PRESSURE_MIN, PRESSURE_MAX+1, PRESSURE_STEP): coord = self.graph_to_screen(-self.width / 2, @@ -62,6 +62,8 @@ class SkewTGraph(): cr.rel_line_to(self.width, 0) cr.stroke() + cr.restore() + def skew_t_to_graph(self, x: float, y: float): return (x+y, y) @@ -75,6 +77,12 @@ class SkewTGraph(): return self.graph_to_screen(*self.sample_to_graph(temp, pressure)) def draw_isotherms(self, cr: cairo.Context, x: float, y: float): + cr.save() + + cr.set_source_rgb(0.5, 0.5, 0.5) + cr.set_line_width(0.5) + cr.set_dash([5, 5], 1) + for temp in range(-150, TEMP_MAX+1, TEMP_STEP): x1, y1 = self.sample_to_screen(temp, PRESSURE_MAX) x2, y2 = self.sample_to_screen(temp, PRESSURE_MIN) @@ -88,6 +96,8 @@ class SkewTGraph(): cr.line_to(x + x2, y + y2) cr.stroke() + cr.restore() + def draw_samples(self, cr: cairo.Context, x: float,