# ---
# jupyter:
#   jupytext:
#     text_representation:
#       extension: .py
#       format_name: light
#       format_version: '1.5'
#       jupytext_version: 1.14.4
#   kernelspec:
#     display_name: Python 3
#     language: python
#     name: python3
# ---

# +
# greece

def display_flag(canvas, objects):
    plt.figure(figsize=canvas)
    plt.axis("on")
    
    for o in objects:
        plt.fill(o.x, o.y, c=o.col)

objs = []

bg= rect(0, 0, 0.9, 0.9, [0,0,1])
objs.append(bg)

lines_w_short1 = rect (0.3, 0.8, 0.9, 0.7, [1,1,1]) 
lines_w_short2 = rect (0.3, 0.6, 0.9, 0.5, [1,1,1])
lines_w_long1 = rect (0, 0.4, 0.9, 0.3, [1,1,1])
lines_w_long2 = rect (0, 0.2, 0.9, 0.1, [1,1,1])

lines_w_cross1 = rect (0, 0.7, 0.3, 0.6, [1,1,1])
lines_w_cross2 = rect (0.12, 0.4, 0.18, 0.9, [1,1,1])

objs.append(lines_w_short1)
objs.append(lines_w_short2)
objs.append(lines_w_long1)
objs.append(lines_w_long2)
objs.append(lines_w_cross1)
objs.append(lines_w_cross2)


#objs.append(star(0.5, 0.5, 0.1, 5, [1,1,1]))





display_flag((6,3), objs)

# +
# cyprus
import matplotlib.pyplot as plt
import matplotlib.image as mpimg

image = mpimg.imread("cyprus_outline.png")
plt.imshow(image)
plt.show()

def leaf_A (xpos, ypos, rad, peaks, c):
    s = Polygon()
    res = peaks * 2
    a = 2* math.pi / res
    for i in range(res):
        if i%2==0:
            radius= rad * 0.4
        else:
            radius = rad
        s.x.append(xpos + math.cos(i*a-2)*radius)
        s.y.append(ypos + math.sin(i*a-2)*radius)
    s.col = c
    return s

def leaf_B (xpos, ypos, rad, peaks, c):
    v = Polygon()
    res = peaks * 2
    a = 2* math.pi / res
    for i in range(res):
        if i%2==0:
            radius= rad * 0.4
        else:
            radius = rad
        v.x.append(xpos + math.cos(i*a-12)*radius)
        v.y.append(ypos + math.sin(i*a-12)*radius)
    v.col = c
    return v

def leaf_C (xpos, ypos, rad, peaks, c):
    v = Polygon()
    res = peaks * 2
    a = 2* math.pi / res
    for i in range(res):
        if i%2==0:
            radius= rad * 0.4
        else:
            radius = rad
        v.x.append(xpos + math.cos(i*a-15)*radius)
        v.y.append(ypos + math.sin(i*a-15)*radius)
    v.col = c
    return v
        
    

leaf_1 = leaf_A(0.1, 0.1, 0.05, 2, [0.086, 0.596, 0.254])
leaf_2 = leaf_B(0.14, 0.14, 0.05, 2, [0.086, 0.596, 0.254])
leaf_3 = leaf_C(0.08, 0.16, 0.05, 2, [0.086, 0.596, 0.254])






def display_flag_cy(canvas, objects, png):
    plt.figure(figsize=canvas)
    plt.axis("on")
    for o in objects:
        plt.fill(o.x, o.y, c=o.col)
    for p in png:
        plt.figimage(p, -130, -120,  resize=bool)


    
    
    

objs_cy = []
image_cy = []


bg_cy = rect(0, 0, 0.9, 0.9, [1,1,1])
objs_cy.append(bg_cy)
image_cy.append(image)
objs_cy.append(leaf_1)
objs_cy.append(leaf_2)
objs_cy.append(leaf_3)



display_flag_cy((6,3), objs_cy, image_cy)

StarcoderdataJupyterScriptsDedupFiltered