diff --git a/get_ee_from_region.py b/get_ee_from_region.py index 0e285bd..9bb454b 100755 --- a/get_ee_from_region.py +++ b/get_ee_from_region.py @@ -264,7 +264,7 @@ def get_image_grid_max(image_path, grid_size=(15,15)): # 2. Create 3D Line Chart using Cairo (No Matplotlib) -def create_3d_line_chart_svg(data, output_path, svg_size=(1200, 1200)): +def create_3d_line_chart_svg(data, output_path, svg_size=(800, 800)): surface = cairo.SVGSurface(output_path, svg_size[0], svg_size[1]) cr = cairo.Context(surface) @@ -276,8 +276,8 @@ def create_3d_line_chart_svg(data, output_path, svg_size=(1200, 1200)): # Projects (x,y,z) -> (x+z/2, y+z/2) def project(x, y, z, xscale=20, yscale=10, offset=(0, 0)): shelf = 0 if z == 0 else z+2 - #shelf = z - return (offset[0] + x * xscale, offset[1] + y * yscale + shelf/2) + shelf = z + return (offset[0] + x * xscale, offset[1] + y * yscale + shelf) #return (offset[0] + x * scale + z * 2, offset[1] + y * scale + z * 2) rows, cols = data.shape @@ -289,8 +289,8 @@ def create_3d_line_chart_svg(data, output_path, svg_size=(1200, 1200)): # Draw Lines along rows cr.set_source_rgb(0, 0, 0) # Black lines cr.set_line_width(1.0) - lastz = 0 - lasty = 0 + x=0 + y=0 for r in range(rows): for c in range(cols): z = norm_data[r, c] @@ -299,14 +299,8 @@ def create_3d_line_chart_svg(data, output_path, svg_size=(1200, 1200)): cr.move_to(x, y+50) cr.line_to(x, y) else: - if lastz == 0: - cr.line_to(x, lasty) - if z == 0 and lastz != 0: - cr.line_to(x, lasty) cr.line_to(x, y) - lastz=z - lasty=y - cr.move_to(x, y + 50) + cr.line_to(x, y + 50) cr.close_path() cr.set_source_rgb(1,1,1) cr.fill_preserve() @@ -339,6 +333,6 @@ logging.debug(t.end().report()) # Plot t = Timerlog("Convert to SVG").start() -create_3d_line_chart_svg(grid_max, target_region_name+".svg", svg_size=(1200,1200)) +create_3d_line_chart_svg(grid_max, target_region_name+".svg", svg_size=(800,800)) print("SVG file created: "+ target_region_name+".svg") logging.debug(t.end().report())