Commit b90e7637 authored by Blais, Chris's avatar Blais, Chris
Browse files

qol updates for the layout plotter

parent 9ab15352
Loading
Loading
Loading
Loading
+18 −8
Original line number Diff line number Diff line
@@ -42,7 +42,12 @@ def plot_bl_layout(layout_plt, varbs_bl):
                ) # m1
            

def plot_layout_any(layout_plt, layout_name, varbs, x_coords = [], y_coords = [], ):
def plot_layout_any(layout_plt, layout_name, varbs, 
                    x_coords = [], y_coords = [], 
                    xoff=120, yoff=0,
                    fontsize=25, figsize=(45,20),
                    title = ""
                    ):

    """
    layout_name: the name of the layout, 'pilot', 'minimal'
@@ -51,13 +56,14 @@ def plot_layout_any(layout_plt, layout_name, varbs, x_coords = [], y_coords = []
    # print(img_folder)
    mem_img_path = os.path.join(img_folder, f"{layout_name}_layout.png")
    mem_img = np.asarray(Image.open(mem_img_path))
    fig, ax = plt.subplots(figsize=(45,20))
    fig, ax = plt.subplots(figsize=figsize)
    ax.imshow(mem_img, aspect="auto")

    conc_xoffset = 120 # x offset for concentration
    conc_yoffset = 0
    press_xoffset = 220 # offset for pressure
    press_yoffset = 0

    conc_xoffset = xoff
    press_xoffset = conc_xoffset + xoff
    conc_yoffset = yoff
    press_yoffset = conc_yoffset + yoff


    # xy positions for text
@@ -79,6 +85,9 @@ def plot_layout_any(layout_plt, layout_name, varbs, x_coords = [], y_coords = []
                ys =  [
                    450, 450, 450, 200, 1075, 500, 175, 1075, 500, 175, 1075, 500, 175, 1250, 1475, 1475, 1475
                ] 
        case _:
            xs = x_coords
            ys = y_coords
    
    if len(varbs) == len(xs):
        mcp = True, False, False
@@ -113,11 +122,12 @@ def plot_layout_any(layout_plt, layout_name, varbs, x_coords = [], y_coords = []
            elif names[i].lower().startswith("p"):
                color = "red"

            ax.text(coords[0], coords[1], names[i], fontsize=30, weight="bold", color = color) # m1
            ax.text(coords[0], coords[1], names[i], fontsize=fontsize, weight="bold", color = color) # m1
        else: 
            ax.text(
                coords[0], coords[1], names[i], fontsize=30, color = "grey", alpha = 0.5,
                coords[0], coords[1], names[i], fontsize=fontsize, color = "grey", alpha = 0.5,
                ) # m1
    ax.text(800, 50, title, fontsize = 50, )

def make_pretty_labels(varbs, layout):